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

[target-allocator] targets get dropped when using relabel-config Filter with serviceMonitor #1231

Closed
moh-osman3 opened this issue Nov 8, 2022 · 0 comments · Fixed by #1232
Labels
area:target-allocator Issues for target-allocator help wanted Extra attention is needed

Comments

@moh-osman3
Copy link
Contributor

In #1127 a new CRD field called filterStrategy was added. However, the relabel-config option drops all targets in the case of using a serviceMonitor that uses the hashmod action in the relabel_config. The resulting label will be matched with the environment variable $(SHARD), but in the prehook no environment variable substitution is taking place.

       {
        "action": "hashmod",
        "modulus": 1,
        "regex": "(.*)",
        "replacement": "$1",
        "separator": ";",
        "source_labels": [
          "__address__"
        ],
        "target_label": "__tmp_hash"
      },
      {
        "action": "keep",
        "regex": "$(SHARD)",
        "replacement": "$1",
        "separator": ";",
        "source_labels": [
          "__tmp_hash"
        ]
      }

What I expected

filterStrategy: relabel-config to work properly with serviceMonitors. i.e. targets are filtered properly according to prometheus relabel_config

What actually happened

I observe serviceMonitors running in my cluster but no jobs discovered when I set filterStrategy: relabel-config and run

$ curl http://lightstep-collector-targetallocator:80

When checking logs I notice that all targets are dropped.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:target-allocator Issues for target-allocator help wanted Extra attention is needed
Projects
None yet
2 participants