Commit 7248d3b
authored
docs(otel): register on the existing provider instead of replacing it
The usage snippet built a new sdktrace.TracerProvider and made it global.
For the flagship case — an ADK Go agent inside a service that already has
OpenTelemetry configured — this loses AI spans: the OTel global delegation
fires only once, so an already-installed provider's tracers (including
ADK's, cached at package init) stay bound to it and never reach the PostHog
processor, while the replacement provider also drops the user's resource,
sampler, and existing exporters. The README prose already said "register it
on your TracerProvider", which the code contradicted.
Show provider.RegisterSpanProcessor(processor) on the application's own
*sdktrace.TracerProvider, and shut down the processor (not the provider) so
PostHog's setup does not tear down the user's tracing pipeline. Keeps the
fresh-context, error-reported shutdown from the previous fix.
Generated-By: PostHog Desktop
Task-Id: 01e1bd45-4478-4317-8196-8ddfcfe917bf1 parent 2109ad3 commit 7248d3b
1 file changed
Lines changed: 17 additions & 9 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
20 | | - | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
21 | 24 | | |
22 | 25 | | |
23 | 26 | | |
24 | 27 | | |
25 | 28 | | |
26 | 29 | | |
27 | | - | |
28 | | - | |
29 | 30 | | |
30 | | - | |
31 | | - | |
32 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
33 | 38 | | |
34 | 39 | | |
35 | 40 | | |
36 | | - | |
37 | | - | |
| 41 | + | |
| 42 | + | |
38 | 43 | | |
39 | 44 | | |
40 | 45 | | |
41 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
42 | 50 | | |
43 | 51 | | |
44 | 52 | | |
| |||
0 commit comments