-
Notifications
You must be signed in to change notification settings - Fork 128
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
[cowboy instrumenter] Allow users to set custom attributes on span start #128
base: main
Are you sure you want to change the base?
[cowboy instrumenter] Allow users to set custom attributes on span start #128
Conversation
I think this makes sense, just needs to, as you mention, not be read from the environment on every request but once in setup. |
cab4938
to
87668ed
Compare
@tsloughter done. Not sure about the options type, I'm using a keyword at the moment (as I would have done in Elixir to have a better typespec), not sure how it is usually done in Erlang |
Keyword list v map is one of the more annoying interop issues we've run in to in OpenTelemetry -- other main one being I guess I'd say do what is done in Cowboy for options. Is it a map in 2.0 mostly? |
Yes, they are maps in cowboy, I'll change |
So talking with a user it came up the need to do this and they mentioned Javascript instrumentation libraries take a Made me realize we should probably not limit this to attributes but instead take a |
Oops. @bryannaegele corrected me that for sampling the attributes need to be available at the call of So maybe this is ready to merge? |
We'll need a follow up that allows for this: https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#http-request-and-response-headers This fun is more generic and takes the whole req so is fine that it doesn't follow the semconv which only applies to headers. |
Damn, tests fail. |
@tsloughter upgraded deps and a failing test, let's if it works now. |
Before merging we should choose a good name for the option, in principle it can be added also to other HTTP client/server instrumenters. In js for instance they call it |
Yea, I think |
@tsloughter ready |
instrumentation/opentelemetry_cowboy/src/opentelemetry_cowboy.erl
Outdated
Show resolved
Hide resolved
Co-authored-by: Tristan Sloughter <[email protected]>
Is there something missing to this to be merged? |
Hey @albertored. I have to review it still and just got home from 2 weeks of holiday. I'll be working through my backlog over the next couple weeks |
@bryannaegele perfect thanks! I was just wondering if there was something missing from my side |
Maybe better to get this configuration parameter from the setup function instead of application env but for now this PR it's a draft waiting for comments.
The use case is to be able to filter spans with a sampler based on user attributes that, if added after span creation, are not present when the sampling decision is taken.
See also discussion on slack