Skip to content

Should span creation operations raise exceptions? #141

@c24t

Description

@c24t

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:apiCross language API specification issue

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions