summaryrefslogtreecommitdiff
path: root/backend.php
diff options
context:
space:
mode:
authorAndrew Dolgov <[email protected]>2023-04-09 21:20:35 +0300
committerAndrew Dolgov <[email protected]>2023-04-09 21:20:35 +0300
commitc1b3c99667c743d63317748d6338647eaf213184 (patch)
tree3e84f114096df8cd1b158a459f5fe5581f64cd96 /backend.php
parent8f3646a9c93a06f76f6abb31020fdb74b4b1fc59 (diff)
some tracer class fixes / unhardcode jaeger IP
Diffstat (limited to 'backend.php')
-rw-r--r--backend.php11
1 files changed, 9 insertions, 2 deletions
diff --git a/backend.php b/backend.php
index 5b1587741..9fa30db38 100644
--- a/backend.php
+++ b/backend.php
@@ -145,8 +145,8 @@
$b_scope->close();
if ($before) {
+ $m_scope = Tracer::start("method/$method");
if ($method && method_exists($handler, $method)) {
- $m_scope = Tracer::start("method/$method");
$reflection = new ReflectionMethod($handler, $method);
if ($reflection->getNumberOfRequiredParameters() == 0) {
@@ -154,17 +154,21 @@
} else {
user_error("Refusing to invoke method $method of handler $op which has required parameters.", E_USER_WARNING);
header("Content-Type: text/json");
+
+ $m_scope->getSpan()->setTag('error', Errors::E_UNAUTHORIZED);
print Errors::to_json(Errors::E_UNAUTHORIZED);
}
- $m_scope->close();
} else {
if (method_exists($handler, "catchall")) {
$handler->catchall($method);
} else {
header("Content-Type: text/json");
+
+ $m_scope->getSpan()->setTag('error', Errors::E_UNKNOWN_METHOD);
print Errors::to_json(Errors::E_UNKNOWN_METHOD, ["info" => get_class($handler) . "->$method"]);
}
}
+ $m_scope->close();
$a_scope = Tracer::start("after/$method");
$handler->after();
@@ -176,6 +180,7 @@
header("Content-Type: text/json");
print Errors::to_json(Errors::E_UNAUTHORIZED);
+ $scope->getSpan()->setTag('error', Errors::E_UNAUTHORIZED);
$scope->close();
return;
}
@@ -184,6 +189,7 @@
header("Content-Type: text/json");
print Errors::to_json(Errors::E_UNAUTHORIZED);
+ $scope->getSpan()->setTag('error', Errors::E_UNAUTHORIZED);
$scope->close();
return;
}
@@ -193,4 +199,5 @@
header("Content-Type: text/json");
print Errors::to_json(Errors::E_UNKNOWN_METHOD, [ "info" => (isset($handler) ? get_class($handler) : "UNKNOWN:".$op) . "->$method"]);
+ $scope->getSpan()->setTag('error', Errors::E_UNKNOWN_METHOD);
$scope->close();