-
Notifications
You must be signed in to change notification settings - Fork 772
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide db.system
attribute when activity is created for use with sampling
#1971
Comments
@johnduhart If instrumentation is NOT populating already known attributes to the |
@johnduhart Btw - for the SqlClient instrumentation, sampler can see the displayname, which should tell that its a SQL call. Will that work for you? |
Never mind. I just read your full issue description now. |
I'd be happy to open a PR myself to add this, I'm just unsure of where the line for "already known" should be drawn. Is it only things that can be kept in a statically allocated tags collection (eg. |
I think using a "display name" for anything other than displaying to a human reader sounds like bad practice. |
|
I think, the only thing which is already available and can be provided to StartActivity call is the It seems correct if we can statically create tags with |
I'm currently trying to implement a custom sampler that drops database spans that do not have a parent span. Many of our services occasionally make database calls outside of trace, and this produces a bunch of noisy single-span traces that aren't very interesting. We were able to implement this sampling logic easily for our Ruby and Java services, but I'm running into trouble implementing this for .NET.
In order to determine if a given span is a "database span", we've been relying on checking if the
db.system
attribute is present. Sadly, most .NET instrumentation that I've seen so far defers adding this tag until after sampling has occurred.Examples:
The API specification says the following:
I appreciate the desire to minimize performance impact on non-sampled call path, but is it possible to strike a balance? Can we define a set of attributes that should always be provided, and treat that as a best practice for when writing instrumentation?
Workaround
This is the solution I've had to implement for my use case in the meantime:
There's a few drawbacks here, namely that I have to now maintain a static list of all possible names a database span can be created with. This solution also does not work for Redis, which creates an activity using the command name as the activity name.
If the activity source was passed along with the
SamplingParameters
(as described in this specification issue), that would solve the latter problem.The text was updated successfully, but these errors were encountered: