Commit f7cc397
feat(otel): fully enum-driven OtelPluginConfig (#612)
* feat(otel): InvocationOtelPlugin uses config
Replace InvocationOtelPlugin's legacy positional kwargs with a single
OtelPluginConfig, mirroring ExecutionOtelPlugin and the JS SDK plugins.
This adds use_default_tracer_provider, enable_http_instrumentation,
exporter_config, and propagators to the Invocation plugin.
Also align the default provider with JS: when no provider is supplied
the plugin auto-configures an OTLP provider (default_use_global=False)
instead of the global/ADOT provider. Pass use_default_tracer_provider
=True for the global (e.g. ADOT) provider.
Migrated test call sites and README snippets to OtelPluginConfig.
105/105 otel tests pass; ruff and mypy clean.
BREAKING CHANGE: InvocationOtelPlugin no longer accepts positional or
keyword arguments; pass an OtelPluginConfig instead, e.g.
InvocationOtelPlugin(OtelPluginConfig(tracer_provider=...)).
* fix(otel): example handlers use global provider
The two OTel example handlers used InvocationOtelPlugin() with no
config. Now that the plugin defaults to auto-configuring an OTLP
provider (localhost:4318), the example tests time out when no
collector is running. Pass
OtelPluginConfig(use_default_tracer_provider=True) so the examples use
the globally configured provider (a no-op proxy under test), matching
the conformance handler and the prior no-arg behavior.
* refactor(otel): resolve provider source via enum
Simplify the tracer-provider selection by resolving it once into an
explicit ProviderSource (EXPLICIT / GLOBAL / AUTO_OTLP) instead of
recomputing booleans in two places.
- Drop the default_use_global parameter from create_tracer_provider;
both plugins now share the same auto-OTLP default, so the seam is
dead weight.
- Make OtelPluginConfig.use_default_tracer_provider a plain bool
(default False) instead of a tri-state Optional[bool].
- ProviderResult carries source; owns_provider is a derived property.
- register_standalone_instrumentations switches on result.source
rather than (config.tracer_provider, use_default_tracer_provider).
Behavior is unchanged. 105/105 otel tests pass; ruff clean; mypy clean
(pre-existing optional-instrumentation import warnings only).
* refactor(otel): move ProviderSource enum into config
Move the ProviderSource enum into otel_plugin_config and add
resolve_provider_source() so the explicit > global > auto-OTLP precedence
lives in one place. create_tracer_provider becomes a straight switch on the
resolved source. Remove the redundant ProviderResult.owns_provider property
and the dead self._owns_provider fields in both plugins.
* refactor(otel): make config fully provider_source-driven
Replace the use_default_tracer_provider boolean with a provider_source:
ProviderSource field as the single driver of provider selection. tracer_provider
becomes the EXPLICIT-only field; __post_init__ validates that EXPLICIT has a
tracer_provider and GLOBAL/AUTO_OTLP do not. create_tracer_provider switches on
config.provider_source; the redundant resolve_provider_source helper is removed.
ExecutionOtelPlugin ambient-parenting now keys off ProviderSource.GLOBAL.
Tests migrate the explicit-provider+flag shortcut to monkeypatching
trace.get_tracer_provider with provider_source=GLOBAL, matching the existing
InvocationOtelPlugin integration test. Examples updated to provider_source=GLOBAL.
BREAKING CHANGE: use_default_tracer_provider is removed; pass
provider_source=ProviderSource.GLOBAL (ADOT) or ProviderSource.EXPLICIT with a
tracer_provider instead.
* style(otel): apply ruff format
* refactor(otel): default provider_source to GLOBAL
Default OtelPluginConfig.provider_source to ProviderSource.GLOBAL (use the
globally configured provider, e.g. the ADOT Lambda layer) instead of AUTO_OTLP.
* refactor(otel): make AUTO_OTLP branch explicit
Switch create_tracer_provider on each ProviderSource explicitly with an
exhaustive guard, so no branch reads as an implicit default (the default
GLOBAL lives on OtelPluginConfig.provider_source).
* ci: re-trigger ci
* docs(otel): correct provider_source default in comments
Docstrings and an inline comment described the old AUTO_OTLP default,
stating the plugin auto-configures an OTLP provider when nothing is
supplied. The default is now GLOBAL (uses the globally configured, e.g.
ADOT, provider); AUTO_OTLP is the opt-in for a plugin-owned provider.
Comment/docstring-only; no behavior change.
---------
Co-authored-by: silanhe <hsilan@amazon.com>1 parent 7a24c81 commit f7cc397
15 files changed
Lines changed: 326 additions & 173 deletions
File tree
- packages
- aws-durable-execution-sdk-python-examples/src
- otel
- plugin
- aws-durable-execution-sdk-python-otel
- src/aws_durable_execution_sdk_python_otel
- tests
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
44 | 48 | | |
45 | 49 | | |
46 | 50 | | |
47 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
48 | 56 | | |
49 | 57 | | |
50 | 58 | | |
| |||
Lines changed: 10 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
6 | 10 | | |
7 | 11 | | |
8 | 12 | | |
| |||
32 | 36 | | |
33 | 37 | | |
34 | 38 | | |
35 | | - | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
36 | 44 | | |
37 | 45 | | |
38 | 46 | | |
| |||
Lines changed: 27 additions & 17 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
168 | 168 | | |
169 | 169 | | |
170 | 170 | | |
| 171 | + | |
171 | 172 | | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | | - | |
181 | | - | |
182 | | - | |
183 | | - | |
184 | | - | |
185 | | - | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
186 | 190 | | |
187 | 191 | | |
188 | 192 | | |
| |||
193 | 197 | | |
194 | 198 | | |
195 | 199 | | |
| 200 | + | |
196 | 201 | | |
197 | 202 | | |
198 | 203 | | |
199 | 204 | | |
200 | 205 | | |
201 | | - | |
| 206 | + | |
202 | 207 | | |
203 | 208 | | |
204 | | - | |
| 209 | + | |
205 | 210 | | |
206 | 211 | | |
207 | 212 | | |
| |||
251 | 256 | | |
252 | 257 | | |
253 | 258 | | |
254 | | - | |
255 | | - | |
256 | | - | |
257 | | - | |
| 259 | + | |
| 260 | + | |
| 261 | + | |
| 262 | + | |
| 263 | + | |
| 264 | + | |
| 265 | + | |
| 266 | + | |
| 267 | + | |
258 | 268 | | |
259 | 269 | | |
260 | 270 | | |
| |||
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
20 | 21 | | |
21 | 22 | | |
22 | 23 | | |
| |||
44 | 45 | | |
45 | 46 | | |
46 | 47 | | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
49 | 51 | | |
| |||
Lines changed: 9 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
62 | 62 | | |
63 | 63 | | |
64 | 64 | | |
| 65 | + | |
65 | 66 | | |
66 | 67 | | |
67 | 68 | | |
| |||
92 | 93 | | |
93 | 94 | | |
94 | 95 | | |
95 | | - | |
| 96 | + | |
| 97 | + | |
96 | 98 | | |
97 | 99 | | |
98 | 100 | | |
| |||
101 | 103 | | |
102 | 104 | | |
103 | 105 | | |
104 | | - | |
105 | 106 | | |
106 | 107 | | |
107 | 108 | | |
108 | 109 | | |
109 | 110 | | |
110 | | - | |
111 | 111 | | |
112 | 112 | | |
113 | | - | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
114 | 117 | | |
115 | 118 | | |
116 | 119 | | |
| |||
129 | 132 | | |
130 | 133 | | |
131 | 134 | | |
132 | | - | |
133 | | - | |
134 | | - | |
135 | | - | |
136 | | - | |
137 | | - | |
| 135 | + | |
138 | 136 | | |
139 | 137 | | |
140 | 138 | | |
| |||
244 | 242 | | |
245 | 243 | | |
246 | 244 | | |
247 | | - | |
| 245 | + | |
248 | 246 | | |
249 | 247 | | |
250 | 248 | | |
| |||
Lines changed: 14 additions & 19 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
22 | 22 | | |
23 | 23 | | |
24 | 24 | | |
| 25 | + | |
25 | 26 | | |
26 | | - | |
27 | | - | |
28 | 27 | | |
| 28 | + | |
29 | 29 | | |
30 | 30 | | |
31 | 31 | | |
| 32 | + | |
32 | 33 | | |
33 | 34 | | |
34 | 35 | | |
| |||
98 | 99 | | |
99 | 100 | | |
100 | 101 | | |
101 | | - | |
102 | | - | |
103 | | - | |
104 | | - | |
| 102 | + | |
105 | 103 | | |
106 | | - | |
| 104 | + | |
107 | 105 | | |
108 | 106 | | |
109 | 107 | | |
110 | | - | |
111 | | - | |
112 | | - | |
| 108 | + | |
113 | 109 | | |
114 | | - | |
115 | | - | |
116 | | - | |
| 110 | + | |
| 111 | + | |
117 | 112 | | |
118 | 113 | | |
119 | | - | |
| 114 | + | |
120 | 115 | | |
121 | 116 | | |
122 | 117 | | |
123 | 118 | | |
124 | | - | |
125 | | - | |
126 | | - | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
127 | 122 | | |
128 | | - | |
| 123 | + | |
Lines changed: 50 additions & 28 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
45 | 45 | | |
46 | 46 | | |
47 | 47 | | |
48 | | - | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
| |||
80 | 84 | | |
81 | 85 | | |
82 | 86 | | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
88 | | - | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
| 94 | + | |
89 | 95 | | |
90 | 96 | | |
91 | 97 | | |
92 | 98 | | |
93 | | - | |
94 | | - | |
95 | | - | |
96 | | - | |
97 | | - | |
98 | | - | |
99 | | - | |
100 | | - | |
101 | | - | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
| 104 | + | |
| 105 | + | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
102 | 110 | | |
103 | 111 | | |
104 | 112 | | |
105 | | - | |
106 | | - | |
| 113 | + | |
107 | 114 | | |
108 | | - | |
109 | | - | |
110 | | - | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
111 | 118 | | |
112 | | - | |
113 | | - | |
| 119 | + | |
114 | 120 | | |
115 | | - | |
| 121 | + | |
116 | 122 | | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
117 | 136 | | |
118 | | - | |
119 | 137 | | |
120 | 138 | | |
121 | 139 | | |
| |||
128 | 146 | | |
129 | 147 | | |
130 | 148 | | |
131 | | - | |
132 | 149 | | |
133 | 150 | | |
134 | 151 | | |
135 | 152 | | |
136 | 153 | | |
137 | | - | |
| 154 | + | |
138 | 155 | | |
139 | 156 | | |
140 | | - | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
141 | 163 | | |
142 | 164 | | |
143 | 165 | | |
| |||
0 commit comments