You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
How http.client_ip is derived from headers eg. they need RFC 7239 Forwarded as well as X-Forwarded-For
How the trace context is derived from headers eg. they need to handle Honeycomb beeline as well as traceparent
Their own attributes derived from the conn
Other stuff that hasn't occurred to me
Strikes me we could let them do all that with one config item instead of half a dozen:
Add a custom_start callback option
Expose our attributes making machinery so they can call it to get most of the heavy lifting done for free
Our code would look something like this:
# our codedefhandle_start(_,_,%{conn: conn},%{custom_start: custom_start})docustom_start.(conn)rescue_->:any_plans_for_how_to_stop_one_mistake_from_turning_off_tracing_forever?end@doc"Call `OpenTelemetry.Tracer.start_span/2` with our tracer, not yours."defstart_span(span_name,start_opts),do:OpenTelemetry.Tracer.start_span(span_name,start_opts)
Not hard, and lets them get as custom as they want:
# their codedefmy_custom_start(conn,start_span)doifmy_should_trace?(conn)domy_propagate_from(conn.req_headers)OpentelemetryPlug.start_span(span_name,%{attributes: my_attributes(conn)})endenddefpmy_should_trace?(conn)do# checks the method or route, whateverenddefpmy_propagate_from(conn)do# calls :ot_propagation.http_extract/1 if it sees a traceparent# ensures equivalent if it sees another headerenddefpmy_attributes(conn)do# calls OpentelemetryPlug.default_attributes/1# pipes it through Map.merge/2 with some more attributesend
The text was updated successfully, but these errors were encountered:
Splitting this one out of #1…
Users might want to customise:
http.client_ip
is derived from headers eg. they need RFC 7239 Forwarded as well as X-Forwarded-Fortraceparent
conn
Strikes me we could let them do all that with one config item instead of half a dozen:
custom_start
callback optionOur code would look something like this:
Not hard, and lets them get as custom as they want:
The text was updated successfully, but these errors were encountered: