Repository navigation
fix(ansible): name the daemon's log stream decdn-node - #64
Merged
Merged
Conversation
The journald pipeline shipped every unit with job=integrations/node_exporter and the fleet labels, but no service_name, so the daemon's logs could not be queried or correlated by service the way its metrics and spans are. loki.relabel "journal_identity" now stamps service_name (from grafana_alloy_service_name) on the decdn-node.service stream only. Host units keep their labels unchanged, and job stays on the integration value so the Linux Server log dashboards still match. The rule is skipped when grafana_alloy_service_name is empty. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Copilot review overview
🟡 Changes recommended
Add coverage for logs-enabled renders with an empty service name.
Get a fresh assessment by requesting another Copilot review.
Review effort: Lite
Findings: 1
Open (1)
What changed in this PR
Updates Grafana Alloy journald relabeling so only decdn-node.service receives service_name, with documentation and validation updates.
Changes:
- Adds daemon-specific Loki relabeling.
- Updates README and defaults documentation.
- Extends rendered-config validation.
| File | Summary |
|---|---|
ansible/tests/alloy-config/validate.sh |
Validates the new relabel rule. |
ansible/roles/grafana_alloy/templates/config.alloy.j2 |
Applies labeling only to daemon logs. |
ansible/roles/grafana_alloy/README.md |
Documents resulting log labels. |
ansible/roles/grafana_alloy/defaults/main.yml |
Clarifies label behavior. |
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Review follow-ups for the daemon log-stream service_name rule: - Docs claimed service_name lands "only" on node metrics, spans and the daemon's journald stream, and that "" drops it everywhere. The OTLP transform also stamps service.name on logs/metrics pushed to the local endpoint, and "" there only stops the overwrite. README now lists the three places Alloy sets it, notes that systemd's crash-loop lines for the daemon arrive as unit="init.scope", and that Loki may derive a service_name for label-less streams. - Replace the "EVERY series/span/log line" wording (defaults, README, preflight) that the change made self-contradictory. - render.yml's minimal fixture now blanks grafana_alloy_service_name, and validate.sh asserts the metric rule, journald rule and OTTL statement all vanish while the journald relabeller survives. The defaults render also pins the rule's source label and replacement value. Co-Authored-By: Claude Opus 5 (1M context) <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
loki.relabel "journal_identity"adds a replace rule: ifunitmatchesdecdn-node\.service, it setsservice_nametografana_alloy_service_name. Other units don't match, so they keep their current labels.jobstays on the value the identity rules set (by defaultintegrations/node_exporter), so the Linux Server log dashboards still match. The rule isn't rendered whengrafana_alloy_service_nameis empty.The README now lists the three places Alloy sets
service_name:/metricsseries;service.name, overwriting the sender's value;It also covers two caveats:
unit="init.scope", so{service_name="decdn-node"}won't show a crash loop;service_namefor streams that don't have one.Rewrote the "EVERY series/span/log line" wording in defaults, README and preflight. It contradicted the new rule and was already slightly wrong.
Tests
validate.shnow checks, ondefaults.alloy, the rule'ssource_labels, regex,target_labelandreplacement. These checks depend on column alignment, and a comment says why.minimalfixture inrender.ymlnow setsgrafana_alloy_service_name: "". On that render,validate.shchecks that the metric rule, the journald rule and the OTTLservice.namestatement are all gone, and that the journald identity relabeller is still there.Test plan
make lint-alloypasses: the real pinned Alloy v1.19.2 accepts all 9 renders, and every check passes.defaultschecks fail. Removing the Jinja guard makes the blank-service_namecheck fail.make lint(pre-commit) andmake lint-ansible(production profile) pass.🤖 Generated with Claude Code