Allow configuring a TextMapPropagator for SQLCommenter#540
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #540 +/- ##
=======================================
+ Coverage 86.5% 86.7% +0.1%
=======================================
Files 16 16
Lines 746 752 +6
=======================================
+ Hits 646 652 +6
Misses 74 74
Partials 26 26 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
3e43cf6 to
53a2d0f
Compare
|
Hi @simonbos, thanks for creating this PR. I am not sure it can address #192 as it seems to require dynamic key-value based on query. The propagator can only propagate static values without the support of special context tools provided to users. But it is useful to add an API for user to replacement the propagator used for sql commenter (related PR open-telemetry/semantic-conventions#2495). Could you add tests for cases to cover the new options with sql commenter enabled ? It probably can catch the nil pointer issue when this new option is not setup. Please also update the changelog file. |
f358e07 to
53a45c3
Compare
|
Hi @XSAM , sorry for the late reply 🙏
I am not an expert, but I think users of the package could create a custom propagator similar to the
|
XSAM
left a comment
There was a problem hiding this comment.
I added an extra test case for the nil case to the commenter_test, any other test case you would like to see?
Could you add a test case for the new added option in TestOptions from option_test.go?
Regarding the nil issue, I could find the issue anymore. It could be my misread.
53a45c3 to
d3cc8a7
Compare
d3cc8a7 to
318a6d3
Compare
|
Sorry for the delay, I added the test case and added the experimental clarification. |
###⚠️ Notice⚠️ This release contains breaking changes: - `RegisterDBStatsMetrics` now returns `(metric.Registration, error)` (previously returned only `error`) so callers can `Unregister()` the callback and avoid memory leaks. - If you need to unregister: `reg, err := RegisterDBStatsMetrics(...)` + `defer reg.Unregister()`. - If you do not need to unregister: `_, err := RegisterDBStatsMetrics(...)`. - `WithAttributes` now appends attributes when specified multiple times (previously overwrote existing attributes). - If you relied on overwriting: consolidate your attributes into a single `WithAttributes(...)` call. ### Added - `WithTextMapPropagator` allows customization of the OTel text map propagator used by SQLCommenter. (#540) This is an experimental feature and may be changed or removed in a later release. ### Removed - Drop support for [Go 1.23]. (#533) ### Changed - Reduce allocations and improve performance when creating spans. (#549) - Reduce allocations when recording metrics. (#550) - `RegisterDBStatsMetrics` now returns a `metric.Registration` so callbacks can be unregistered. (#580) - `WithAttributes` now accumulates attributes across multiple calls instead of overwriting. (#576) - Upgrade OTel to `v1.39.0`. (#583) [Go 1.23]: https://go.dev/doc/go1.23
This allows users to not rely on the global TextMapPropagator. It might be enough to close #192 because then users are free to implement a custom propagator which is specific for the SQLCommenter use case without polluting the global TextMapPropagator.