Skip to content

Commit

Permalink
[php] parametric: update dd and otel flush endpoints (#3514)
Browse files Browse the repository at this point in the history
Co-authored-by: Bob Weinand <[email protected]>
  • Loading branch information
mabdinur and bwoebi authored Nov 20, 2024
1 parent dd6a987 commit e2e6abd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 8 deletions.
1 change: 0 additions & 1 deletion manifests/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -332,7 +332,6 @@ tests/:
Test_Parametric_DDSpan_Start: bug (APMAPI-778) # Does not support creating a child span from a finished span
Test_Parametric_DDTrace_Baggage: missing_feature (baggage is not supported)
Test_Parametric_DDTrace_Current_Span: bug (APMAPI-778) # current span endpoint should return span and trace id of zero if no span is "active"
Test_Parametric_DDTrace_Flush: missing_feature (flush endpoint is not implemented, the lack of this feature introduce flakiness in all tests)
Test_Parametric_Otel_Baggage: missing_feature (otel baggage is not supported)
Test_Parametric_Otel_Current_Span: bug (APMAPI-778) # otel current span endpoint should return a span and trace id of zero if no span is "active"
test_partial_flushing.py:
Expand Down
17 changes: 10 additions & 7 deletions utils/build/docker/php/parametric/server.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,11 @@ function remappedSpanKind($spanKind) {
return jsonResponse([]);
}));
$router->addRoute('POST', '/trace/span/flush', new ClosureRequestHandler(function () use (&$spans) {
\DDTrace\flush();
dd_trace_internal_fn("synchronous_flush");
dd_trace_synchronous_flush(1000); # flush spans with a timeout of 1s
return jsonResponse([]);
}));
$router->addRoute('POST', '/trace/stats/flush', new ClosureRequestHandler(function () use (&$spans) {
# NOP: php doesn't expose an API to flush trace stats
return jsonResponse([]);
}));
$router->addRoute('GET', '/trace/span/current', new ClosureRequestHandler(function () use (&$spans, &$activeSpan) {
Expand Down Expand Up @@ -398,11 +401,11 @@ function remappedSpanKind($spanKind) {
return jsonResponse([]);
}));
$router->addRoute('POST', '/trace/otel/flush', new ClosureRequestHandler(function (Request $req) {
\DDTrace\flush();
dd_trace_internal_fn("synchronous_flush");
return jsonResponse([
'success' => true
]);
$timeout = (arg($req, 'seconds') ?: 0.1) * 1000; # convert timeout to ms
dd_trace_synchronous_flush($timeout);
return jsonResponse([
'success' => true
]);
}));
$router->addRoute('POST', '/trace/otel/is_recording', new ClosureRequestHandler(function (Request $req) use (&$otelSpans) {
$spanId = arg($req, 'span_id');
Expand Down

0 comments on commit e2e6abd

Please sign in to comment.