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

apmzap does not start tracer loop unless logger.Error is called #1416

Open
carsonip opened this issue Apr 21, 2023 · 3 comments
Open

apmzap does not start tracer loop unless logger.Error is called #1416

carsonip opened this issue Apr 21, 2023 · 3 comments
Labels

Comments

@carsonip
Copy link
Member

apmzap does not start tracer loop when used, which means no metrics are sent periodically in the background. Only after a zap logger.Error is called, the tracer loop is started.

apmzap.Core.Write uses the default tracer and will start the tracer loop but apmzap.Core.Write is only called when apmzap.Core.Check allows: link to code. The side effect of starting the tracer loop on first logger.Error call seems unexpected.

@axw
Copy link
Member

axw commented Apr 24, 2023

This doesn't sound like something that apmzap should be responsible for.

Given that apmzap is meant for correlating logs with traces, shouldn't the tracer be initialised by instrumentation independently of logging?

@carsonip
Copy link
Member Author

carsonip commented Apr 24, 2023

Given that apmzap is meant for correlating logs with traces, shouldn't the tracer be initialised by instrumentation independently of logging?

Yes that makes sense. @lahsivjar and I assumed that system metrics would be sent out of the box once we use apmzap, but it is reasonable that it does not. But what about the behavior that it starts sending after the first apmzap logger.Error is called?

@axw
Copy link
Member

axw commented Apr 24, 2023

@carsonip I agree that's a bit surprising. Actually my earlier comment is not really correct:

Given that apmzap is meant for correlating logs with traces

It's not just meant for that; it also sends errors. I think that's the issue here. I guess I see your thinking now: instrumenting something for tracing triggers metrics collection, so why doesn't instrumenting code for sending errors? Not sure if we can make them consistent while keeping a decent API, but I guess it's reasonable.

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

No branches or pull requests

2 participants