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

Cannot inject envs to targetAllocator #1773

Open
sumo-drosiek opened this issue May 30, 2023 · 5 comments · Fixed by #1875
Open

Cannot inject envs to targetAllocator #1773

sumo-drosiek opened this issue May 30, 2023 · 5 comments · Fixed by #1875
Labels
area:target-allocator Issues for target-allocator

Comments

@sumo-drosiek
Copy link
Member

We have several serviceMonitors, which are using environment variables, e.g:

spec:
  endpoints:
  - port: otelcol-metrics
  namespaceSelector:
    matchNames:
    - $(NAMESPACE)
  selector:
    matchLabels:
      sumologic.com/app: fluentd-metrics
      sumologic.com/scrape: "true"

It would be nice to add and support env in targetAllocator so we could seamlessly migrate from Prometheus to OpenTelemetry

@swiatekm
Copy link
Contributor

This is a bit tricky, as this substitution is done by config reloader in prometheus-operator managed configurations. See: https://github.com/thanos-io/thanos/blob/main/pkg/reloader/reloader.go#L82.

This means that the variables are substituted in Prometheus' environment, which maps to the otelcol environment in our case. With TargetAllocator enabled though, Prometheus receiver gets this configuration directly from the TA. Doing the substitution in Prometheus receiver itself would represent a break from Prometheus upstream semantics.

We could do the substitution in TA, using TA's environment. This seems fairly straightforward to do if we want to, the more difficult question is whether we should. On one hand, we'd be more compatible with prometheus-operator, which is a pretty big deal considering this is the primary purpose of TA. On the other hand, it wouldn't be exactly the same thing, and the ambiguity could trip some people up. Technically, we could automatically mirror the env variables from the collector to the TA, and be fully compatible that way, but that would make this feature a lot more complicated.

I'm cautiously in favor of doing it in the TA in a naive way and documenting it.

@gracewehner
Copy link

+1, my team would also like this and are ok with it being in the TA

@pavolloffay pavolloffay added the area:target-allocator Issues for target-allocator label Jun 8, 2023
@jaronoff97
Copy link
Contributor

@KitSutliff is going to take this one! 🥳

@swiatekm
Copy link
Contributor

swiatekm commented Dec 7, 2023

#1875 is not enough to resolve this issue. It did add the ability to define env variables in the Target Allocator, but not variable expansion for the configuration.

@KitSutliff
Copy link
Contributor

great catch, I can add a couple lines to address it next week

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
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants