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

Add metrics for log events #3150

Open
StephenButtolph opened this issue Jun 26, 2024 · 1 comment
Open

Add metrics for log events #3150

StephenButtolph opened this issue Jun 26, 2024 · 1 comment
Labels
enhancement New feature or request good first issue Good for newcomers lifecycle/frozen monitoring This primarily focuses on logs, metrics, and/or tracing

Comments

@StephenButtolph
Copy link
Contributor

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:

// Log that a fatal error has occurred. The program should likely exit soon
// after this is called
Fatal(msg string, fields ...zap.Field)
// Log that an error has occurred. The program should be able to recover
// from this error
Error(msg string, fields ...zap.Field)
// Log that an event has occurred that may indicate a future error or
// vulnerability
Warn(msg string, fields ...zap.Field)
// Log an event that may be useful for a user to see to measure the progress
// of the protocol
Info(msg string, fields ...zap.Field)
// Log an event that may be useful for understanding the order of the
// execution of the protocol
Trace(msg string, fields ...zap.Field)
// Log an event that may be useful for a programmer to see when debuging the
// execution of the protocol
Debug(msg string, fields ...zap.Field)
// Log extremely detailed events that can be useful for inspecting every
// aspect of the program
Verbo(msg string, fields ...zap.Field)

It would be nice to add metrics here:

// Should only be called from [Level] functions.
func (l *log) log(level Level, msg string, fields ...zap.Field) {
if ce := l.internalLogger.Check(zapcore.Level(level), msg); ce != nil {
ce.Write(fields...)
}
}
that would count the number of calls by loggerName and log level

@StephenButtolph StephenButtolph added enhancement New feature or request monitoring This primarily focuses on logs, metrics, and/or tracing labels Jun 26, 2024
@aaronbuchwald aaronbuchwald added the good first issue Good for newcomers label Jun 26, 2024
Copy link

github-actions bot commented Sep 1, 2024

This issue has become stale because it has been open 60 days with no activity. Adding the lifecycle/frozen label will cause this issue to ignore lifecycle events.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers lifecycle/frozen monitoring This primarily focuses on logs, metrics, and/or tracing
Projects
Status: Backlog 🗄️
Development

No branches or pull requests

3 participants