Skip to content

Commit

Permalink
filters: deprecate OpenTracing in FilterContext (#3044)
Browse files Browse the repository at this point in the history
Deprecate OpenTracing FilterContext getters and remove their usage from filters.

For #2104

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored Apr 26, 2024
1 parent 7e22667 commit 6ee45b1
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 2 deletions.
7 changes: 7 additions & 0 deletions filters/filters.go
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,16 @@ type FilterContext interface {
Metrics() Metrics

// Allow filters to add Tags, Baggage to the trace or set the ComponentName.
//
// Deprecated: OpenTracing is deprecated, see https://github.com/zalando/skipper/issues/2104.
// Use opentracing.SpanFromContext(ctx.Request().Context()).Tracer() to get the proxy span Tracer.
Tracer() opentracing.Tracer

// Allow filters to create their own spans
//
// Deprecated: OpenTracing is deprecated, see https://github.com/zalando/skipper/issues/2104.
// Filter spans should be children of the proxy span,
// use opentracing.SpanFromContext(ctx.Request().Context()) to get the proxy span.
ParentSpan() opentracing.Span

// Returns a clone of the FilterContext including a brand new request object.
Expand Down
2 changes: 1 addition & 1 deletion filters/openpolicyagent/openpolicyagent.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,7 +599,7 @@ func (opa *OpenPolicyAgentInstance) startSpanFromContextWithTracer(tr opentracin
}

func (opa *OpenPolicyAgentInstance) StartSpanFromFilterContext(fc filters.FilterContext) (opentracing.Span, context.Context) {
return opa.startSpanFromContextWithTracer(fc.Tracer(), fc.ParentSpan(), fc.Request().Context())
return opa.StartSpanFromContext(fc.Request().Context())
}

func (opa *OpenPolicyAgentInstance) StartSpanFromContext(ctx context.Context) (opentracing.Span, context.Context) {
Expand Down
2 changes: 1 addition & 1 deletion proxy/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ func (c *context) Split() (filters.FilterContext, error) {
}

func (c *context) Loopback() {
loopSpan := c.Tracer().StartSpan(c.proxy.tracing.initialOperationName, opentracing.ChildOf(c.ParentSpan().Context()))
loopSpan := c.tracer.StartSpan(c.proxy.tracing.initialOperationName, opentracing.ChildOf(c.parentSpan.Context()))
defer loopSpan.Finish()
err := c.proxy.do(c, loopSpan)
if c.response != nil && c.response.Body != nil {
Expand Down

0 comments on commit 6ee45b1

Please sign in to comment.