feat(mongo): add SpanNameResolver for customizable span naming#7986
Conversation
fc23cbf to
0dd6c01
Compare
0dd6c01 to
e528e47
Compare
e528e47 to
807588d
Compare
|
This will need a changelog entry. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7986 +/- ##
=====================================
Coverage 80.9% 81.0%
=====================================
Files 194 194
Lines 13073 13081 +8
=====================================
+ Hits 10588 10596 +8
Misses 2107 2107
Partials 378 378
🚀 New features to boost your workflow:
|
I added one |
Co-authored-by: Damien Mathieu <42@dmathieu.com>
8c36929 to
8a811ee
Compare
df66b8e to
ac9e992
Compare
|
@dmathieu could you please merge? :) |
|
We require 2 approvals to merge. |
|
Ping @prestonvasquez :) |
…nto feat/mongo-span-name-resolver # Conflicts: # instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/go.mod # instrumentation/go.mongodb.org/mongo-driver/v2/mongo/otelmongo/go.sum
…nto feat/mongo-span-name-resolver
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
Co-authored-by: Preston Vasquez <prestonvasquez@icloud.com>
|
@dmathieu the pipeline is currently failing (as far as I can see, nothing I broke) and I don't have the permission to merge or restart the pipeline. Could you do that please? :) |
|
@dmathieu I think we're ready to merge! 🥳 |
|
We require 2 approvals to merge. |
|
@prestonvasquez could you approve? |
| if collection, err := extractCollection(evt); err == nil && collection != "" { | ||
| spanName = collection + "." | ||
|
|
||
| collection, err := extractCollection(evt) |
There was a problem hiding this comment.
In fact, when using the default SpanNameFormatter, we executed the extractCollection method twice. Is there a better way?
Secondly, it seems that users cannot access the collection information. Unless it implements a similar logic itself.
There was a problem hiding this comment.
See #7986 (comment)
That helper method should be made available by the mongo SDK, not by us.
prestonvasquez
left a comment
There was a problem hiding this comment.
LGTM, thanks @Azer0s 👍
This PR adds a SpanNameResolver function to the monitor options in order to customize the span name to the users needs. This is especially relevant when dealing with multiple database instances, having to prefix spans, or generally needing to customize the span name.