Skip to content

Commit 0300aaf

Browse files
rkennkeclaude
andcommitted
context: add ContextSetter.size() (pure-Java slot count)
The dd-trace-java Phase 2 bridge sizes its app-offset arrays from the context attribute count. It previously read that as snapshotTags().length — a DBB read that creates a ThreadContext. Expose size() (attributes.size(), pure Java) so the bridge can size without touching the DBB path; offsetOf + size are the only ContextSetter methods it still uses. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 019e0f5 commit 0300aaf

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

ddprof-lib/src/main/java/com/datadoghq/profiler/ContextSetter.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,11 @@ public int offsetOf(String attribute) {
6969
return attributes.indexOf(attribute);
7070
}
7171

72+
/** Number of (deduplicated, truncated) context attribute slots. Pure Java; no native/DBB read. */
73+
public int size() {
74+
return attributes.size();
75+
}
76+
7277
public boolean setContextValue(String attribute, String value) {
7378
return setContextValue(offsetOf(attribute), value);
7479
}

0 commit comments

Comments
 (0)