From open-telemetry/opentelemetry-python#11 (review).
The java tracer API docs note that calling spanBuilder with a null spanName arg should raise a NullPointerException. NoopSpanBuilder does this, but SpanBuilderSdk doesn't.
Two questions here:
Should we create a span with a default name (as @reyang and @carlosalberto suggest) instead of raising if the span name is null here? If we want to avoid exceptions in the API altogether this suggests we should also create a blank span current if the user calls Tracer.withSpan with a null span, but this seems less defensible than using a default name.
More generally, which errors should implementations raise? I could imagine letting the implementation be either more or less restrictive than the API, but if it can both raise exceptions that aren't listed in the API and choose not to raise exceptions that are... then there doesn't seem to be much point to listing exceptions in the API.
From open-telemetry/opentelemetry-python#11 (review).
The java tracer API docs note that calling
spanBuilderwith a nullspanNamearg should raise aNullPointerException.NoopSpanBuilderdoes this, butSpanBuilderSdkdoesn't.Two questions here:
Should we create a span with a default name (as @reyang and @carlosalberto suggest) instead of raising if the span name is null here? If we want to avoid exceptions in the API altogether this suggests we should also create a blank span current if the user calls
Tracer.withSpanwith a nullspan, but this seems less defensible than using a default name.More generally, which errors should implementations raise? I could imagine letting the implementation be either more or less restrictive than the API, but if it can both raise exceptions that aren't listed in the API and choose not to raise exceptions that are... then there doesn't seem to be much point to listing exceptions in the API.