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

Feature request: expose NoopTracer #567

Closed
skaji opened this issue Jan 14, 2020 · 2 comments
Closed

Feature request: expose NoopTracer #567

skaji opened this issue Jan 14, 2020 · 2 comments

Comments

@skaji
Copy link
Contributor

skaji commented Jan 14, 2020

Context

I'm using dd-trace-go in both development and production environments.
While I'm using a "true" tracer in production environment,
I'm using a mocktracer in development environment:

if os.Getenv("ENV") == "production" {
	tracer.Start()
} else {
	mocktracer.Start()
}

// share the same code in both production and development environments
span := tracer.StartSpan("some-resource")
// do something
span.Finish() // actual tracing happens only in production environment

Recently I have noticed that the memory usage in development environment was increasing.
This is because mocktracers keep all finished spans in memory.

s.tracer.addFinishedSpan(s)

Feature request

I would like "noop" tracers.
There already exists NoopTracer in the internal package, so how about exposing it?

type NoopTracer struct{}

Or, it may be better to add an option to mocktracers to disable keeping finished spans.

@skaji
Copy link
Contributor Author

skaji commented Jan 14, 2020

... oh, I just should not have started mocktracers in development environment.

@skaji skaji closed this as completed Jan 14, 2020
@gbbr
Copy link
Contributor

gbbr commented Jan 14, 2020

Glad you figured it out. If there is anything we can do better in documentation to make this clearer, please let me know...

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

No branches or pull requests

2 participants