Skip to content

Conversation

raelga
Copy link

@raelga raelga commented Jun 16, 2025

This pull request introduces several updates to modernize the codebase, including upgrading dependencies, switching to a newer logging library, and following Prometheus metric naming conventions. The changes enhance compatibility, improve readability, and align with current best practices.

Dependency Updates:

  • Updated the Go version in Dockerfile to 1.24.4 and in go.mod to 1.24. This ensures compatibility with the latest language features and optimizations.
  • Upgraded Prometheus and other dependencies in go.mod to newer versions, improving stability and adding support for modern features.

Logging Library Migration:

  • Replaced go-kit/log with slog for logging in collect.go and main.go. This simplifies log handling and improves the structure of log messages.

Metric Naming Improvements:

Code Refactoring:

  • Replaced promlog with promslog in main.go to align with updated Prometheus libraries. Adjusted related flag and logger initialization accordingly.

These changes collectively enhance the maintainability, readability, and compliance of the codebase with modern standards. It will introduce breaking changes, as all the metrics will be renamed. The current names, raise errors in modern prometheus installations:

ts=2025-06-16T21:00:34.529958436Z caller=rule.go:945 level=warn component=rules warnings="PromQL info: metric might not be a counter, name does not end in _total/_sum/_count/_bucket: \"sendgrid_requests\"" query="increase(sendgrid_requests{namespace=\"prometheus-exporter\"}[1h]) > 30000"
ts=2025-06-16T21:00:34.532503147Z caller=rule.go:945 level=warn component=rules warnings="PromQL info: metric might not be a counter, name does not end in _total/_sum/_count/_bucket: \"sendgrid_bounce_drops\"" 

...
ts=2025-06-16T21:04:04.535100232Z caller=rule.go:945 level=warn component=rules warnings="PromQL info: metric might not be a counter, name does not end in _total/_sum/_count/_bucket: \"sendgrid_bounce_drops\"" query="increase(sendgrid_bounce_drops{namespace=\"prometheus-exporter\"}[1h]) > 6000"

@raelga
Copy link
Author

raelga commented Jun 16, 2025

cc @cw-sakamoto

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

Successfully merging this pull request may close these issues.

1 participant