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

Shutdown SDK providers on process exit #302

Open
anuraaga opened this issue Jan 24, 2025 · 1 comment
Open

Shutdown SDK providers on process exit #302

anuraaga opened this issue Jan 24, 2025 · 1 comment
Labels
enhancement New feature or request

Comments

@anuraaga
Copy link

Is your feature request related to a problem? Please describe.

Currently spans are not flushed on process exit, especially notable when instrumenting a CLI type of command rather than server. I could confirm adding a time.Sleep at the end fixes it, as well as getting the provider to shut it down manually

func main() {
	ctx := context.Background()

	tp := otel.GetTracerProvider()
	if sdktp, ok := tp.(*trace.TracerProvider); ok {
		defer sdktp.Shutdown(ctx)
	}

	...

Describe the solution you'd like

For application to be instrumented automatically to shutdown on exit - this behavior matches javaagent.

Describe alternatives you've considered

No response

Additional context

No response

@anuraaga anuraaga added the enhancement New feature or request label Jan 24, 2025
@123liuziming
Copy link
Collaborator

I' will fix that, thanks for your feedback

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants