Opentelemetry-js: custom `SpanProcessor`s api definition issue

Created on 6 May 2020  路  3Comments  路  Source: open-telemetry/opentelemetry-js

There are still problems around implementing custom SpanProcessors like:

import * as api from '@opentelemetry/api'
import * as tracing from '@opentelemetry/tracing'

export class CustomSpanProcessor implements api.SpanProcessor {
  // api.SpanProcessor says it's an api.Span, 
  // but in SimpleSpanProcessor it assumes Span to be tracing.Span, which is one possible implementation of api.Span.
  onStart(span: tracing.Span) {
    /** api.Span doesn't provide any necessary APIs to access span fields :( */
  }
}

This can be identified as a bug of the definition of api.SpanProcessor and api.Span (maybe move tracing.ReadableSpan to api.ReadableSpan).

Most helpful comment

At the very least, the onStart method should probably receive a ReadableSpan instead of a Span

All 3 comments

ah I think I see the issue now. I think actually the SpanProcessor should be removed from the api package entirely as it is not a user-facing API

@mayurkale22 wdyt

At the very least, the onStart method should probably receive a ReadableSpan instead of a Span

Was this page helpful?
0 / 5 - 0 ratings