Repository navigation
Commit ff8e7ba
fix(strands): skip Strands' OTLP exporter only for an exact duplicate on a provider that keeps its exporter (TH-8727)
43e25de skipped Strands' OTLP exporter whenever a processor on the
provider exported to the same host and port. Review found two ways that
loses spans:
- On fi-instrumentation-otel 1.1.0, register() still marks its exporter
as a default the next add_span_processor() call replaces. With
OTEL_EXPORTER_OTLP_* at Future AGI, the skip left that marked exporter
as the only one, and the next processor (enable_console_exporter=True,
or one the application adds) replaced it: Future AGI got nothing.
traceai-strands 0.1.0 never hit this, because Strands' own exporter
consumed the mark.
- When register() ran without FI keys and the keys reached Strands'
exporter through otlp_headers or OTEL_EXPORTER_OTLP_HEADERS, the skip
removed the only exporter Future AGI would accept.
The exporter is now skipped only when all of these hold:
- the provider would keep its exporter on the next add_span_processor()
call: no `_default_processor` mark on that provider. This is the flag
the core's add_span_processor() override reads, checked on the
provider being configured rather than through a version number. On
1.1.0 Strands' exporter is then added exactly as in 0.1.0. A bare
fi_instrumentation TracerProvider() whose construction default is
still pending replacement is covered by the same check.
- a processor on the provider exports to the same traces URL: scheme,
userinfo, host, port (default filled in), path (repeated and trailing
slashes dropped) and query, instead of host and port only;
- that exporter already sends every header Strands' exporter would
send, with the same value, and no client certificate or credential
provider is set for Strands' exporter.
Strands' endpoint and headers come from an upstream OTLPSpanExporter
built with no arguments, as Strands builds it, read back and shut down.
That follows the installed exporter release: 1.45 merges environment
headers into passed ones and moved them to `_client`, and treats an
empty OTEL_EXPORTER_OTLP_TRACES_ENDPOINT differently from 1.29-1.39.
A floor of fi-instrumentation-otel>=1.1.1 was not added: it would make
traceai-strands 0.1.1 uninstallable until the core is published (and
fail this repo's CI install from PyPI), tie it to a version number that
changes if #272 ships first, and still not protect an environment
resolved without it (--no-deps, a lock pinned to 1.1.0).
Tests: unit tests for each rule (URL parts and spellings, keys only on
one side, other keys, x-project-name, unreadable headers, mTLS and
credential-provider variables, both header layouts, the marked
provider). README Option 1 run for real, now also with the console
exporter, a processor added afterwards, keys only on Strands' exporter
and a base endpoint, on the repo core and on 1.1.0. README Option 1 and
the CHANGELOG say exactly when the exporter is added.
Co-Authored-By: Claude Opus 5.5 <[email protected]>1 parent 43e25de commit ff8e7ba
6 files changed
Lines changed: 564 additions & 111 deletions
File tree
- python/frameworks/strands
- tests
- traceai_strands
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
4 | | - | |
5 | | - | |
6 | | - | |
7 | | - | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
8 | 17 | | |
9 | 18 | | |
10 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
54 | 54 | | |
55 | 55 | | |
56 | 56 | | |
57 | | - | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
58 | 66 | | |
59 | 67 | | |
60 | 68 | | |
| |||
225 | 233 | | |
226 | 234 | | |
227 | 235 | | |
228 | | - | |
| 236 | + | |
229 | 237 | | |
230 | 238 | | |
231 | 239 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
6 | | - | |
7 | | - | |
8 | | - | |
9 | | - | |
10 | | - | |
11 | | - | |
12 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
13 | 21 | | |
14 | 22 | | |
15 | 23 | | |
16 | | - | |
| 24 | + | |
| 25 | + | |
17 | 26 | | |
18 | 27 | | |
19 | 28 | | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
| |||
28 | 38 | | |
29 | 39 | | |
30 | 40 | | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
31 | 44 | | |
32 | | - | |
33 | | - | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
34 | 49 | | |
35 | 50 | | |
36 | 51 | | |
| |||
39 | 54 | | |
40 | 55 | | |
41 | 56 | | |
| 57 | + | |
42 | 58 | | |
43 | | - | |
| 59 | + | |
44 | 60 | | |
45 | 61 | | |
46 | 62 | | |
| |||
67 | 83 | | |
68 | 84 | | |
69 | 85 | | |
70 | | - | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
71 | 91 | | |
72 | 92 | | |
73 | 93 | | |
| |||
77 | 97 | | |
78 | 98 | | |
79 | 99 | | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
80 | 106 | | |
81 | 107 | | |
82 | 108 | | |
| |||
87 | 113 | | |
88 | 114 | | |
89 | 115 | | |
90 | | - | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
91 | 123 | | |
92 | 124 | | |
93 | 125 | | |
94 | 126 | | |
95 | 127 | | |
96 | | - | |
| 128 | + | |
97 | 129 | | |
98 | 130 | | |
99 | | - | |
100 | | - | |
101 | | - | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
102 | 137 | | |
103 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
104 | 141 | | |
105 | 142 | | |
106 | 143 | | |
107 | | - | |
108 | | - | |
109 | 144 | | |
110 | 145 | | |
111 | 146 | | |
112 | 147 | | |
113 | 148 | | |
| 149 | + | |
| 150 | + | |
114 | 151 | | |
115 | 152 | | |
116 | 153 | | |
| |||
124 | 161 | | |
125 | 162 | | |
126 | 163 | | |
127 | | - | |
128 | | - | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
129 | 172 | | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
130 | 178 | | |
131 | 179 | | |
132 | 180 | | |
133 | 181 | | |
134 | 182 | | |
135 | 183 | | |
136 | 184 | | |
137 | | - | |
| 185 | + | |
| 186 | + | |
138 | 187 | | |
139 | 188 | | |
140 | 189 | | |
141 | 190 | | |
142 | | - | |
143 | | - | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
144 | 195 | | |
145 | 196 | | |
146 | 197 | | |
| |||
0 commit comments