Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add exported function to close all spans and flush #1902

Merged
merged 3 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ddtrace.sym
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
ddtrace_flush_tracer
ddtrace_close_all_spans_and_flush
ddtrace_get_profiling_context
ddtrace_root_span_add_tag
get_module
8 changes: 7 additions & 1 deletion ext/auto_flush.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
#include "serializer.h"
#include "span.h"

DDTRACE_PUBLIC ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup) {
ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup) {
bool success = true;

zval trace, traces;
Expand Down Expand Up @@ -57,3 +57,9 @@ DDTRACE_PUBLIC ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup) {

return success ? SUCCESS : FAILURE;
}

DDTRACE_PUBLIC void ddtrace_close_all_spans_and_flush()
{
ddtrace_close_all_open_spans(true);
ddtrace_flush_tracer(true);
}
4 changes: 3 additions & 1 deletion ext/auto_flush.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@
#include <php.h>
#include <stdbool.h>

ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup);

// This function is exported and used by appsec
DDTRACE_PUBLIC ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup);
DDTRACE_PUBLIC void ddtrace_close_all_spans_and_flush(void);

#endif // DDTRACE_AUTO_FLUSH_H