apm-agent-go
apm-agent-go copied to clipboard
apmzap does not start tracer loop unless logger.Error is called
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.
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?
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?
@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.