Skip to content

Commit

Permalink
Add dyanmic log file capabilities
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Weinand <[email protected]>
  • Loading branch information
bwoebi committed Jan 26, 2024
1 parent ca93c16 commit b5f0b92
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
3 changes: 2 additions & 1 deletion components-rs/sidecar.h
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,8 @@ ddog_MaybeError ddog_sidecar_session_set_config(ddog_SidecarTransport **transpor
uint64_t flush_interval_milliseconds,
uintptr_t force_flush_size,
uintptr_t force_drop_size,
ddog_CharSlice log_level);
ddog_CharSlice log_level,
ddog_CharSlice log_path);

ddog_MaybeError ddog_sidecar_send_trace_v04_shm(ddog_SidecarTransport **transport,
const struct ddog_InstanceId *instance_id,
Expand Down
3 changes: 2 additions & 1 deletion ext/sidecar.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ static bool dd_sidecar_connection_init(void) {
get_global_DD_TRACE_AGENT_FLUSH_INTERVAL(),
get_global_DD_TRACE_AGENT_STACK_INITIAL_SIZE(),
get_global_DD_TRACE_AGENT_STACK_BACKLOG() * get_global_DD_TRACE_AGENT_MAX_PAYLOAD_SIZE(),
get_global_DD_TRACE_DEBUG() ? DDOG_CHARSLICE_C("debug") : dd_zend_string_to_CharSlice(get_global_DD_TRACE_LOG_LEVEL()));
get_global_DD_TRACE_DEBUG() ? DDOG_CHARSLICE_C("debug") : dd_zend_string_to_CharSlice(get_global_DD_TRACE_LOG_LEVEL()),
(ddog_CharSlice){ .ptr = logpath, .len = strlen(logpath) });

return true;
}
Expand Down
2 changes: 1 addition & 1 deletion libdatadog
25 changes: 25 additions & 0 deletions tests/ext/close_spans_until.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,34 @@ var_dump(DDTrace\close_spans_until(null));

?>
--EXPECTF--
[ddtrace] [span] Creating new root SpanStack: 1, parent_stack: 0
[ddtrace] [span] Creating new root SpanStack: 3, parent_stack: 1
[ddtrace] [span] Switching to different SpanStack: 3
[ddtrace] [span] Starting new root span: trace_id=%s, span_id=%d, parent_id=0, SpanStack=3, parent_SpanStack=1
[ddtrace] [span] Starting new span: trace_id=%s, span_id=%d, parent_id=%d, SpanStack=3
[ddtrace] [span] Starting new span: trace_id=%s, span_id=%d, parent_id=%d, SpanStack=3
[ddtrace] [span] Starting new span: trace_id=%s, span_id=%d, parent_id=%d, SpanStack=3
bool(false)
[ddtrace] [span] Closing span: trace_id=%s, span_id=%d
[ddtrace] [span] Closing span: trace_id=%s, span_id=%d
int(2)
[ddtrace] [span] Starting new span: trace_id=%s, span_id=%d, parent_id=%d, SpanStack=3
[ddtrace] [span] Starting new span: trace_id=%s, span_id=%d, parent_id=%d, SpanStack=3
[ddtrace] [span] Starting new span: trace_id=%s, span_id=%d, parent_id=%d, SpanStack=3
[ddtrace] [span] Closing span: trace_id=%s, span_id=%d
[ddtrace] [span] Closing span: trace_id=%s, span_id=%d
int(2)
[ddtrace] [span] Closing span: trace_id=%s, span_id=%d
[ddtrace] [span] Closing span: trace_id=%s, span_id=%d
[ddtrace] [span] Closing root span: trace_id=%s, span_id=%d
[ddtrace] [span] Switching to different SpanStack: 1
int(1)
int(0)
[ddtrace] [span] Encoding span %d: trace_id=%s, name='close_spans_until.php', service='close_spans_until.php', resource: 'close_spans_until.php', type 'cli' with tags: runtime-id='%s', _dd.p.dm='-0', _dd.p.tid='%s'; and metrics: process_id='%d', _dd.agent_psr='1', _sampling_priority_v1='1', php.compilation.total_time_ms='%f'
[ddtrace] [span] Encoding span %d: trace_id=%s, name='traced', service='close_spans_until.php', resource: 'traced', type 'cli' with tags: -; and metrics: -
[ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: -
[ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: -
[ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: -
[ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: -
[ddtrace] [span] Encoding span %d: trace_id=%s, name='', service='close_spans_until.php', resource: '', type 'cli' with tags: -; and metrics: -
[ddtrace] [info] Flushing trace of size 7 to send-queue for %s
2 changes: 2 additions & 0 deletions tests/ext/sandbox/die_in_sandbox.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ x();
?>
--EXPECTF--
[ddtrace] [warning] UnwindExit thrown in ddtrace's closure defined at %s:%d for x(): <exit>
[ddtrace] [span] Encoding span %d: trace_id=%s, name='die_in_sandbox.php', service='die_in_sandbox.php', resource: 'die_in_sandbox.php', type 'cli' with tags: runtime-id='%s', _dd.p.dm='-0', _dd.p.tid='%s'; and metrics: process_id='%d', _dd.agent_psr='1', _sampling_priority_v1='1', php.compilation.total_time_ms='%f'
[ddtrace] [span] Encoding span %d: trace_id=%s, name='x', service='die_in_sandbox.php', resource: 'x', type 'cli' with tags: -; and metrics: -
[ddtrace] [info] Flushing trace of size 2 to send-queue for %s

0 comments on commit b5f0b92

Please sign in to comment.