summaryrefslogtreecommitdiff
path: root/classes/diskcache.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-04-09 21:37:17 +0300
committerAndrew Dolgov <[email protected]>2023-04-09 21:37:17 +0300
commitd68c736e4727bbb5b5ee83adcb08ac9fc23b58ac (patch)
tree77ab9801ca5a5e4c7b13036e504e741089f2faf3 /classes/diskcache.php
parent6418157ccf4034e191f15e36d141e7703bbc88b0 (diff)
Tracer: rework options to tags
Diffstat (limited to 'classes/diskcache.php')
-rw-r--r--classes/diskcache.php19
1 files changed, 18 insertions, 1 deletions
diff --git a/classes/diskcache.php b/classes/diskcache.php
index 2a3f8c8d7..0965c4388 100644
--- a/classes/diskcache.php
+++ b/classes/diskcache.php
@@ -304,11 +304,16 @@ class DiskCache implements Cache_Adapter {
}
public function send(string $filename) {
+ $scope = Tracer::start(__FUNCTION__, ['filename' => $filename]);
+
$filename = basename($filename);
if (!$this->exists($filename)) {
header($_SERVER["SERVER_PROTOCOL"]." 404 Not Found");
echo "File not found.";
+
+ $scope->getSpan()->setTag('error', '404 not found');
+ $scope->close();
return false;
}
@@ -317,6 +322,9 @@ class DiskCache implements Cache_Adapter {
if (($_SERVER['HTTP_IF_MODIFIED_SINCE'] ?? '') == $gmt_modified || ($_SERVER['HTTP_IF_NONE_MATCH'] ?? '') == $file_mtime) {
header('HTTP/1.1 304 Not Modified');
+
+ $scope->getSpan()->setTag('error', '304 not modified');
+ $scope->close();
return false;
}
@@ -334,6 +342,9 @@ class DiskCache implements Cache_Adapter {
header("Content-type: text/plain");
print "Stored file has disallowed content type ($mimetype)";
+
+ $scope->getSpan()->setTag('error', '400 disallowed content type');
+ $scope->close();
return false;
}
@@ -355,7 +366,13 @@ class DiskCache implements Cache_Adapter {
header_remove("Pragma");
- return $this->adapter->send($filename);
+ $scope->getSpan()->setTag('mimetype', $mimetype);
+
+ $rc = $this->adapter->send($filename);
+
+ $scope->close();
+
+ return $rc;
}
public function get_full_path(string $filename): string {