-
Notifications
You must be signed in to change notification settings - Fork 124
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
Normalize HTTP instrumenters options #201
Comments
This is actually spec compliant and is contained in the API spec. Operators are allowed to mark a span as Ok unless explicitly prevented from doing so by another part of the spec. HTTP does not contain any prevention. |
The specification is very clear, thanks for sharing. I got confused by the HTTP semantic conventions (https://github.com/open-telemetry/semantic-conventions/blob/main/docs/http/http-spans.md#status) where setting span status to error for codes >= 400 is a MUST |
If this is the case (the span can be marked as ok as configured) then we should extend this functionality also to other libs and to 2xx and 3xx status codes, now it is allowed only for 4xx and 5xx ones. |
Moving here a comment from @tsloughter
|
You can only mark an error'd span ok. Those codes aren't errors. |
I know it's not fun, but you might want to spend some time reading through the General, API, and SDK sections of the spec to get a good understanding of the foundations. |
I read it but my understanding of the total order part was "once set to ok the status can't change" not "to set the status to ok it must pass from an error one", thanks for clarifying that to me. I also hope my previous messages don't sound arrogant, it was not my intention but not being a native English speaker I imagine they can be misread |
No worries on the language bit :) The intent of |
At the moment we have 3 HTTP server instumneters (
cowboy
,phoenix
andelli
) and 4 HTTP client ones (finch
,httpoison
,req
andtesla
).They expose some common option, some options that somehow overlap but are not equal and some options that are specific to that instrumenter.
Proposed options
The set of common options I would like to have on each HTTP instrumenter is the following:
{req|resp}_headers_to_span_attributes
- this allows to give a list of request/response headers to be used as span attributes as per semantic conventions. A PR for adding this is already open, see Allow to configure which headers should be used as span attrs #184span_name
- this option should be a string (for fixed span names) or a function that takes as input the request (the representation of the request depends on the library) and return the span name.TBD if the string value is needed or if it's ok to allow only the function, it should behave like
request_hook
below.This is already implemented (partially) by some instrumenters:
httpoison
takesot_span_name
with value the actual span name (a string)req
takesspan_name
with value the actual span name (a string)tesla
takesspan_name
with value the actual span name (a string) or a function taking as argument the%Telsa.Env{}
structrequest_hook
- function that takes as input the request and returns an enumerable of span attributes to be set on span creation. This is useful to add attributes that can be used for sampling decisions.TBD not fully satisfied with the name, it should somehow explain that is returning span attributes.
TBD should be possible to give a fixed enumerable of attributes instead of a function? It should behave like
span_name
above.This is already implemented (partially) by some instrumenters:
cowboy
in PR [cowboy instrumenter] Allow users to set custom attributes on span start #128elli
has theserver_name
option to add a specifichttp.server_name
attributehttpoison
has theot_attributes
option but is is a fixed map of attributes and not a function. It also has a convoluted logic that takes into account theot_resource_route
andinfer_route
options to set thehttp.route
span attribute.propagate_ctx
- boolean, whether to propagate the trae context in outoging requests (only for HTTP clients).TBD if a boolean is sufficient or if taking a propagator as input (as done in
tesla
, see below) can be useful.This is already implemented (partially) by some instrumenters:
req
with thepropagate_trace_ctx
option (bool)tesla
with thepropagator
option that can be anotel_propagator:t()
or the atom:none
Actual extra options
In addition to these options some library expose its own specific ones:
tesla
has themark_status_ok
options to allow setting the span status to ok to request that returns an HTTP status code that is normally mapped as an error. This is against semantic conventions, we should decide if extending this option to other instrumenters or removing it fromtesla
.elli
has theexluded_paths
option to allow excluding some paths from automatic span creation, may be useful to add it to other instrumenters?req
has theno_path_params
option, whose use is not so clear to mephoenix
has some specific options that do not need any change (endpoint_prefix
andadapter
)The text was updated successfully, but these errors were encountered: