-
Notifications
You must be signed in to change notification settings - Fork 703
Open
0 / 50 of 5 issues completedLabels
blocked: specificationWaiting on clarification of the OpenTelemetry specification before progress can be madeWaiting on clarification of the OpenTelemetry specification before progress can be madeinstrumentation: otelhttp
Description
We're starting to look into stabilizing the go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp package.
For that, we need to audit the public API of the package, not for missing things (as those could be added later) but for things that should be changed before we can't do breaking changes anymore.
For reference, this is the API as it is with the latest release:
func ContextWithLabeler(parent context.Context, l *Labeler) context.Context
func ContextWithStartTime(parent context.Context, start time.Time) context.Context
func Get(ctx context.Context, targetURL string) (resp *http.Response, err error)
func Head(ctx context.Context, targetURL string) (resp *http.Response, err error)
func NewHandler(handler http.Handler, operation string, opts ...Option) http.Handler
func NewMiddleware(operation string, opts ...Option) func(http.Handler) http.Handler
func Post(ctx context.Context, targetURL, contentType string, body io.Reader) (resp *http.Response, err error)
func PostForm(ctx context.Context, targetURL string, data url.Values) (resp *http.Response, err error)
func StartTimeFromContext(ctx context.Context) time.Time
func Version() string
func WithRouteTag(route string, h http.Handler) http.Handler
type Filter
type Labeler
func LabelerFromContext(ctx context.Context) (*Labeler, bool)
func (l *Labeler) Add(ls ...attribute.KeyValue)
func (l *Labeler) Get() []attribute.KeyValue
type Option
func WithClientTrace(f func(context.Context) *httptrace.ClientTrace) Option
func WithFilter(f Filter) Option
func WithMessageEvents(events ...event) Option
func WithMeterProvider(provider metric.MeterProvider) Option
func WithMetricAttributesFn(metricAttributesFn func(r *http.Request) []attribute.KeyValue) Option
func WithPropagators(ps propagation.TextMapPropagator) Option
func WithPublicEndpoint() Option
func WithPublicEndpointFn(fn func(*http.Request) bool) Option
func WithServerName(server string) Option
func WithSpanNameFormatter(f func(operation string, r *http.Request) string) Option
func WithSpanOptions(opts ...trace.SpanStartOption) Option
func WithTracerProvider(provider trace.TracerProvider) Option
type Transport
func NewTransport(base http.RoundTripper, opts ...Option) *Transport
func (t *Transport) RoundTrip(r *http.Request) (*http.Response, error)
This issue is open for any comment opinions before that stabilization.
Critical Issues (Must Fix Before Stabilization)
- Remove ReadBytesKey, ReadErrorKey, WroteBytesKey, WriteErrorKey from public API #8130
- Stabilization of error recording semantic conventions is a blocker - Need to wait for stabilization of error recording spec before proceeding.
- Decide on span events vs log events and
WithMessageEvents()implications - Need to determine if span events should migrate to log events prior to stabilization, possibly behind a feature flag. This impacts theWithMessageEvents()option. - Consider renaming
NewMiddleware - Consider renaming
Transport - otelhttp: make DefaultClient a non-mutable variable #8131
- otelhttp: WithMessageEvents` accepts an unexported type as a parameter. - Fix type declaration to not contain unexported types #8132
Important Issues (Should Fix)
- Deprecate and remove
WithRouteTagoption - This option can be replaced withWithMetricAttributesFnfor controllinghttp.routein metrics. - Rethink
Labelertype design and API integration - TheLabelertype is for metrics but isn't clearly connected to the rest of the API. Its purpose and representation need to be reconsidered. - Consider splitting
Optiontypes for Handler and Transport - Handler and Transport currently share the same option type, but options likeWithClientTraceandWithSpanNameFormatteronly apply to one. Should split if needed. - Reconsider
ContextWithStartTime/StartTimeFromContextas public API - These functions are strange to have as part of (just) HTTP instrumentation and may not belong in the public API. - Address issues #726 and #4501 before stabilization - These issues significantly alter output behavior and should be resolved before declaring otelhttp stable.
- Consider renaming
LabelertoMetricLabeler- Since the godoc states it only applies to metrics, the name could be more specific. Alternatively, consider adding attributes to spans as well. - Consider renaming
WithFiltertoWithSpanFilter- Since the filter only applies to spans, a more specific name would be clearer. - Consider refactoring the
filterspackage - Move filters to options inotelhttpor as other declarations. - Decide if
Filterneeds to accept other parameters - Address extensibility - Ensure future extensibility - HTTP/2, HTTP/3, WebSockets
- Rethink
WithMetricAttributesFunc- cache or redesign
Nice to Have
- Refactor or rename
common.gofile - The file is overly generic and not representative of what it contains. - Comprehensive package documentation
- Public API benchmarks
Context Notes
- Issue Should we have expert, or generalist handlers? #2782 about generalist vs specific instrumentation is not resolved by this stabilization effort - any changes would introduce breaking changes and the issue hasn't generated momentum. Can be considered for a future v2.
Sub-issues
Metadata
Metadata
Assignees
Labels
blocked: specificationWaiting on clarification of the OpenTelemetry specification before progress can be madeWaiting on clarification of the OpenTelemetry specification before progress can be madeinstrumentation: otelhttp