Skip to content

Commit 8d1b5a7

Browse files
committed
chore(tracer): tighten v1 comments
1 parent 3b077e1 commit 8d1b5a7

4 files changed

Lines changed: 7 additions & 14 deletions

File tree

components-rs/agent_info.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,9 +96,8 @@ pub extern "C" fn ddog_agent_info_json_free(ptr: *mut c_char) {
9696
}
9797
}
9898

99-
/// Returns true when the agent /info `endpoints` list advertises `endpoint`
100-
/// (e.g. `/v1.0/traces`). Returns false when no info has been received yet, so the
101-
/// caller safely treats "agent info unknown" as "endpoint not advertised".
99+
/// Returns whether the agent /info `endpoints` list advertises `endpoint` (e.g. `/v1.0/traces`);
100+
/// false when no info has been received yet ("unknown" == "not advertised").
102101
///
103102
/// # Safety
104103
/// `reader` must be a valid pointer to an `AgentInfoReader`.

tracer/auto_flush.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,10 +69,8 @@ ZEND_RESULT_CODE ddtrace_flush_tracer(bool force_on_startup, bool collect_cycles
6969
.buffer_size = get_global_DD_TRACE_BUFFER_SIZE(),
7070
.url = (ddog_CharSlice) {.ptr = url, .len = strlen(url)},
7171
};
72-
// V1 wire (POST /v1.0/traces) is used only when BOTH the config resolves to
73-
// "1"/"1.0" AND the agent /info advertises "/v1.0/traces". Otherwise (default
74-
// "0.4", explicit 1.0 but agent doesn't advertise it, or agent info not yet
75-
// known) fall back to the unchanged V0.4 path -- the safe default.
72+
// Use the V1 wire only when the protocol config is "1"/"1.0" AND the agent /info
73+
// advertises "/v1.0/traces"; otherwise fall back to the default V0.4 path.
7674
zend_string *protocol_version = get_global_DD_TRACE_AGENT_PROTOCOL_VERSION();
7775
bool use_v1 = (zend_string_equals_literal(protocol_version, "1") ||
7876
zend_string_equals_literal(protocol_version, "1.0")) &&

tracer/dogstatsd_client.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
// TODO: remove this file and put it in the sidecar.
21
#include "dogstatsd_client.h"
32

43
#include <dogstatsd_client/client.h>

tracer/serializer.c

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,17 +1089,15 @@ static void dd_serialize_span_events(zend_array *events, smart_str *buf) {
10891089
}
10901090

10911091
// --- Native V1 span links/events (DD_TRACE_AGENT_PROTOCOL_VERSION=1/1.0) ---
1092-
// On the V1 wire, links/events are emitted into libdatadog's native span structures
1093-
// (span_links field 11, span_events field 12) rather than the JSON-in-meta V0.4 form.
1092+
// On the V1 wire these go into libdatadog's native span structures, not the V0.4 JSON-in-meta form.
10941093

10951094
static bool dd_v1_native_span_enabled(void) {
10961095
zend_string *pv = get_global_DD_TRACE_AGENT_PROTOCOL_VERSION();
10971096
return zend_string_equals_literal(pv, "1") || zend_string_equals_literal(pv, "1.0");
10981097
}
10991098

1100-
// Emit each SpanLink into the native span. trace_id/span_id are hex strings; the V1 link
1101-
// wire has no flags source on the PHP side and no dropped_attributes_count field, so both
1102-
// are omitted. Link attributes are a string map.
1099+
// Emit each SpanLink into the native span. The V1 link wire omits flags and
1100+
// dropped_attributes_count (no PHP-side source); attributes are a string map.
11031101
static void dd_span_links_to_native(zend_array *links, ddog_SpanBytes *rust_span) {
11041102
zval *val;
11051103
ZEND_HASH_FOREACH_VAL(links, val) {
@@ -1143,7 +1141,6 @@ static void dd_span_links_to_native(zend_array *links, ddog_SpanBytes *rust_span
11431141
} ZEND_HASH_FOREACH_END();
11441142
}
11451143

1146-
// Dispatch a single event attribute to the typed native setter based on its zval type.
11471144
static void dd_event_attribute_to_native(ddog_SpanEventBytes *event, ddog_CharSlice key, zval *val) {
11481145
ZVAL_DEREF(val);
11491146
switch (Z_TYPE_P(val)) {

0 commit comments

Comments
 (0)