Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SpanExporter interface inconsistency #2652

Closed
dyladan opened this issue Jul 7, 2022 · 6 comments · Fixed by #2654
Closed

SpanExporter interface inconsistency #2652

dyladan opened this issue Jul 7, 2022 · 6 comments · Fixed by #2654
Assignees
Labels
area:sdk Related to the SDK [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR spec:trace Related to the specification/trace directory

Comments

@dyladan
Copy link
Member

dyladan commented Jul 7, 2022

In the specification for SpanExporter, the Interface Definition paragraph states:

Interface Definition

The exporter must support two functions: Export and Shutdown.

However there are 3 functions listed: Export, Shutdown, and ForceFlush.

Is ForceFlush a required method on the SpanExporter interface?

Additional Context

While implementing the metrics SDK InMemoryMetricsExporter, there was some debate in the JS SIG on if we should have a separate reset method or if the forceFlush method should reset the in-memory state of the exporter. While deciding what to do, we looked at the InMemorySpanExporter for inspiration and found that it was using reset but did not even implement ForceFlush. Since ForceFlush is specified, we realized we had to implement it and an issue (open-telemetry/opentelemetry-js#3067) was created to track this. While working on the issue we became confused by the wording of the spec and are unsure if the spec is trying to require ForceFlush or specifying behavior for an optional interface. All behaviors of ForceFlush are specified as SHOULD requirements.

@dyladan dyladan added the spec:trace Related to the specification/trace directory label Jul 7, 2022
@yurishkuro
Copy link
Member

@dyladan since you already did some leg work studying this portion of the spec and some implementations, do you have a concrete proposal how to address this?

@dyladan
Copy link
Member Author

dyladan commented Jul 7, 2022

I see 2 options:

  1. Add ForceFlush to the Interface Definition paragraph making it:

Interface Definition

The exporter must support three functions: Export, Shutdown, and ForceFlush.

  1. Make ForceFlush specifically optional

Interface Definition

The exporter MUST support two functions: Export and Shutdown. The exporter MAY also support a third function: ForceFlush.

@dyladan
Copy link
Member Author

dyladan commented Jul 7, 2022

If we go with 1 there may be other SDKs besides JS that need to be updated with the required function. If we go with 2 then any SDK like JS which haven't implemented it yet are not required to if they don't want to.

@jsuereth
Copy link
Contributor

jsuereth commented Jul 8, 2022

Looking at history of when forceflush was added, I think this may have just been an omission and your option (1) is the intended solution.

@jsuereth jsuereth added the [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR label Jul 8, 2022
@dyladan
Copy link
Member Author

dyladan commented Jul 8, 2022

Yeah I think that is most likely the original intent

@jsuereth
Copy link
Contributor

jsuereth commented Jul 8, 2022

What I mean was, there was a discussion in the PR about this specifically: #1452 (comment)

Bogdan suggested opening a new issue PR to resolve it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:sdk Related to the SDK [label deprecated] triaged-accepted [label deprecated] Issue triaged and accepted by OTel community, can proceed with creating a PR spec:trace Related to the specification/trace directory
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants