Skip to content

Fix Loki-Metrics initialization race condition#47

Merged
DavidePrincipi merged 4 commits intomainfrom
bug-7780
Jan 19, 2026
Merged

Fix Loki-Metrics initialization race condition#47
DavidePrincipi merged 4 commits intomainfrom
bug-7780

Conversation

@DavidePrincipi
Copy link
Member

@DavidePrincipi DavidePrincipi commented Jan 15, 2026

This PR enables the Metrics module to access Loki metrics like other applications:

  • Allow anonymous access to Prometheus /metrics endpoint
  • Publish endpoint configuration in Redis, as specified by Metrics README

This change resolves a config race condition during cluster initialization between Loki and Metrics.

See also NethServer/ns8-metrics#45

Refs NethServer/dev#7780

Publish the Prometheus metrics endpoint configuration in Redis.
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR resolves a configuration race condition during cluster initialization between Loki and Metrics modules by enabling the Metrics module to discover and scrape Loki's Prometheus metrics endpoint.

Changes:

  • Adds anonymous access to Loki's /metrics endpoint via Traefik routing configuration
  • Creates a provisioning script that publishes Loki's metrics endpoint to Redis for Metrics module discovery
  • Implements the script in both create-module and update-module.d directories for initial setup and updates

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 6 comments.

File Description
imageroot/update-module.d/80provision_metrics Symlink to provision script for module updates
imageroot/scripts/expandconfig-traefik Adds unauthenticated /metrics route with priority 100
imageroot/actions/create-module/80provision_metrics Publishes metrics endpoint configuration to Redis

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

DavidePrincipi and others added 2 commits January 15, 2026 19:53
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Loki instances may be on worker nodes too.
@DavidePrincipi DavidePrincipi merged commit 501cdb2 into main Jan 19, 2026
5 checks passed
@DavidePrincipi DavidePrincipi deleted the bug-7780 branch January 19, 2026 14:17
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.

4 participants