Skip to content

Commit

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

For zalando#2104

Signed-off-by: Alexander Yastrebov <[email protected]>
  • Loading branch information
AlexanderYastrebov authored and Janardhan Sharma committed Jul 19, 2024
1 parent a05b5c8 commit b389527
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 @@ -625,7 +625,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 b389527

Please sign in to comment.