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

Remove guidance about when users should call ForceFlush from the specification #3620

Closed
wants to merge 1 commit into from

Conversation

dashpole
Copy link
Contributor

@dashpole dashpole commented Jul 24, 2023

Changes

The spec for metric exporter's ForceFlush method doesn't currently have any guidance for the SDK authors. Instead, it appears to provide guidance to users about when they should call ForceFlush.

This PR removes that guidance because it is not relevant to the specification of the SDK.

As an alternative, we could keep the guidance, but clarify that SDK authors SHOULD document ForceFlush with it. This was rejected in #3620 (review)

Originally raised here: open-telemetry/opentelemetry-go#4359 (review)

@dashpole dashpole requested review from a team July 24, 2023 20:28
@reyang
Copy link
Member

reyang commented Jul 24, 2023

The spec for metric exporter's ForceFlush method doesn't currently have any guidance for the SDK authors. Instead, it appears to provide guidance to users about when they should call ForceFlush.

Good point!

We have the same issue in other specs, e.g. https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/trace/sdk.md#forceflush-1.

@dashpole
Copy link
Contributor Author

We have the same issue in other specs

Updated the trace and log SDK specs as well.

such as when using some FaaS providers that may suspend the process after an
invocation, but before the `LogRecordProcessor` exports the
emitted `LogRecord`s.
`ForceFlush` SHOULD be documented with a disclaimer stating that it should only
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks okay to me. Just calling out loud, do we want to remove this line entirely? There are many similar APIs such as file.flush https://learn.microsoft.com/en-us/dotnet/api/system.io.filestream.flush.

I guess it could be helpful to explain the cost/consequence rather than saying "only call me when it is absolutely necessary" (part of the reason is that "necessary" is blurry). e.g. https://github.com/open-telemetry/opentelemetry-dotnet/blob/a808276efaf7e7a13420d993cea903cbff262996/src/OpenTelemetry/Logs/LoggerProviderExtensions.cs#L53-L54

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am also fine with removal, if we don't think the disclaimer is necessary.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I personally would vote for removal, maybe let's gather more opinions?
Folks who prefer removal please give 👍, otherwise 👎.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated the PR to remove these sections.

@dashpole dashpole changed the title ForceFlush should have a disclaimer, rather than guidance in the spec Remove guidance about when users should call ForceFlush from the specification Jul 26, 2023
Copy link
Member

@Oberon00 Oberon00 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This PR removes that guidance because it is not relevant to the specification of the SDK.

Formally, you may be right, but I don't see any practical benefit in removing the guidance. Especially when there is no alternative location to move it to.

@MrAlias
Copy link
Contributor

MrAlias commented Jul 28, 2023

This PR removes that guidance because it is not relevant to the specification of the SDK.

Formally, you may be right, but I don't see any practical benefit in removing the guidance. Especially when there is no alternative location to move it to.

The normative guidance is not for the intended readers of this document, it is for their users. Having this language here implies that the SDKs need to somehow restrict the use of ForceFlush to only occur "where it is absolutely necessary". Should they require a reason be passed as a parameter from the user and ensure they only run the function when that reason is to flush something running on a FaaS system so they are complying with the specification?

The practical benefit to removing this is that is removes an at best confusing and at worst unimplementable part of the specification.

The original PR changed this to be something the SDK authors could feasibly accomplish, namely have it be documentation for their users. However, it was recommended to remove it entirely. If you think that is a better approach, can you please coordinate with @reyang so we can reach a resolution here.

@cijothomas
Copy link
Member

An alternative would be to do something similar to:
https://github.com/open-telemetry/opentelemetry-specification/pull/2383/files

@Oberon00
Copy link
Member

I am OK with adding a documentation requirement, but it might be overkill. I can also see why the current wording with SHOULD is technically wrong. How about changing it to a non-normative "Note:" and using lowercase "should" or wording such as "is only meant for ..."?

@github-actions
Copy link

github-actions bot commented Aug 6, 2023

This PR was marked stale due to lack of activity. It will be closed in 7 days.

@github-actions github-actions bot added the Stale label Aug 6, 2023
@github-actions
Copy link

Closed as inactive. Feel free to reopen if this PR is still being worked on.

@github-actions github-actions bot closed this Aug 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants