Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only insert labels that do not already exist #353

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

sed-i
Copy link
Contributor

@sed-i sed-i commented Feb 23, 2024

Issue

Alert labels are being overwritten, when they already exist.
This is a problem for deployments with grafana-agent, such as:

graph LR
some-charm ---|logging| grafana-agent ---|logging| loki
Loading

Before this change, the alert labels of some-charm would be set to grafana-agent's topology.

Solution

Only insert labels that do not already exist. This is exactly what we're doing in cos-lib.

(In a different PR, we should refactor loki_push_api to use cos-lib.)

Addresses canonical/grafana-agent-k8s-operator#275.

Context

This PR is in tandem with:

Testing Instructions

Deploy this bundle:

bundle: kubernetes
applications:
  ga:
    # grafana-agent from https://github.com/canonical/grafana-agent-k8s-operator/pull/277
    # with the modified lib
    charm: ./grafana-agent-k8s_ubuntu-22.04-amd64.charm
    resources:
      agent-image: ubuntu/grafana-agent:0.35.2-22.04_stable
    scale: 1
    trust: true
  loki:
    charm: loki-k8s
    channel: edge
    series: focal
    scale: 1
    trust: true
  trfk:
    charm: traefik-k8s
    channel: edge
    series: focal
    scale: 1
    trust: true
relations:
- - trfk:logging
  - ga:logging-provider
- - ga:logging-consumer
  - loki:logging

and make sure expr labels and alert labels are correct:

juju show-unit loki/0 | yq '."loki/0"."relation-info" | .[] | ."application-data".alert_rules' | jq

Upgrade Notes

This change has no impact on Loki itself, but on related charms, so charmcraft fetch-lib etc.

@dstathis dstathis merged commit 97db0a3 into main Feb 26, 2024
13 checks passed
@dstathis dstathis deleted the feature/fix-label-overwrite branch February 26, 2024 15:12
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