ava-labs / avalanchego

Go implementation of an Avalanche node.
https://avax.network
BSD 3-Clause "New" or "Revised" License
2.09k stars 646 forks source link

Add metrics for log events #3150

Open StephenButtolph opened 2 days ago

StephenButtolph commented 2 days ago

Different log levels are frequently not enabled when running in production due to processing costs. However, significant changes in the frequency of logs is unexpected. To enable monitoring of disabled logs, it would be nice to add a metric that records how frequently different log levels would be logged.

This interface defines the different log levels: https://github.com/ava-labs/avalanchego/blob/318da000780e3c165eb0c01b05da315c19309971/utils/logging/logger.go#L21-L41

It would be nice to add metrics here: https://github.com/ava-labs/avalanchego/blob/318da000780e3c165eb0c01b05da315c19309971/utils/logging/log.go#L82-L87 that would count the number of calls by loggerName and log level