refactor(prometheus): extract shared PrometheusLoggerMetrics helper - #106
Merged
Conversation
Move duplicated built-in metrics state, build_builtin_metrics(), and add_common_labels() from PrometheusPayloadLogger and PrometheusHttpServerLogger into a single helper class. This prevents the two backends from diverging as more metrics are added, and unifies the counter naming (m_failed_collects vs m_failed_exports) to a single m_failed_exports. Scope-risk: narrow Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
…gerMetrics PrometheusLoggerMetrics no longer depends on LOGIT_CURRENT_TIMESTAMP_MS() or config.hpp. Callers pass current timestamp explicitly: - time_since_last_log_ms(int64_t now_ms) - build_builtin_metrics(..., int64_t now_ms) This keeps the helper self-contained and usable without pulling in the full LogIt configuration header. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
build_builtin_metrics,add_common_labels, counter state, and time helpers intoPrometheusLoggerMetrics.m_stopped/stop()fromPrometheusPayloadLogger.m_failed_collectsvsm_failed_exportsnaming tom_failed_exports.Test plan
prometheus_payload_logger_testpassesprometheus_http_server_logger_testpassesprometheus_text_serializer_testpasses🤖 Generated with Claude Code