Skip to content

refactor(prometheus): extract shared PrometheusLoggerMetrics helper - #106

Merged
LimiNode merged 2 commits into
mainfrom
refactor/prometheus-logger-metrics
May 22, 2026
Merged

refactor(prometheus): extract shared PrometheusLoggerMetrics helper#106
LimiNode merged 2 commits into
mainfrom
refactor/prometheus-logger-metrics

Conversation

@LimiNode

Copy link
Copy Markdown
Owner

Summary

  • Extract duplicated build_builtin_metrics, add_common_labels, counter state, and time helpers into PrometheusLoggerMetrics.
  • Remove dead m_stopped/stop() from PrometheusPayloadLogger.
  • Unify m_failed_collects vs m_failed_exports naming to m_failed_exports.
  • No public API changes; behavior unchanged.

Test plan

  • prometheus_payload_logger_test passes
  • prometheus_http_server_logger_test passes
  • prometheus_text_serializer_test passes
  • Example binaries build and run

🤖 Generated with Claude Code

LimiNode and others added 2 commits May 22, 2026 03:44
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>
@LimiNode
LimiNode merged commit 6b7cea4 into main May 22, 2026
12 checks passed
@LimiNode
LimiNode deleted the refactor/prometheus-logger-metrics branch June 3, 2026 00:04
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