Commit d9717ef
refactor(tracing): key the dispatch discriminator on TracingActivityName
Compare activity.info().activity_type against TracingActivityName.START_SPAN /
END_SPAN instead of the string literals "start-span" / "end-span", so the check
can't silently drift from the enum that actually names the activities
(@activity.defn(name=TracingActivityName.START_SPAN)).
Uses a lazy import inside the function to avoid the activities -> TracingService
-> AsyncTracer -> trace import cycle (the reason literals were used originally);
at call time, inside an activity, the module graph is fully loaded so the import
is safe. activity_type round-trips as the enum's str value, which a str-Enum
member compares equal to.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 2bc7a74 commit d9717ef
1 file changed
Lines changed: 17 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
116 | 116 | | |
117 | 117 | | |
118 | 118 | | |
119 | | - | |
120 | | - | |
| 119 | + | |
| 120 | + | |
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | 124 | | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
125 | 136 | | |
126 | 137 | | |
127 | | - | |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
128 | 142 | | |
129 | 143 | | |
130 | 144 | | |
| |||
0 commit comments