Skip to content
This repository has been archived by the owner on Mar 8, 2023. It is now read-only.

Need to pass an extra parameter in addition to 'target' #7

Open
odupuy opened this issue Jan 27, 2018 · 3 comments
Open

Need to pass an extra parameter in addition to 'target' #7

odupuy opened this issue Jan 27, 2018 · 3 comments

Comments

@odupuy
Copy link

odupuy commented Jan 27, 2018

While you will generally be OK to retrieve a metric with the 3 parameters passed in by Prometheus aka task+region+target, there is a case where you need a 'target2' or equivalent.

If you use elastic search then the corresponding metrics are a two-dimension one. ClientId+DomainName.
The ClientId is in fact your AWS account ID (not changing and the domain is your choice when you create an ES domain and you can have many of them.
We have aws_dimensions: [ClientId, Domain].
The problem is that the account ID will be different in your DEV environment, STAGE environment, PROD environment... So you cannot hard-code it in the Docker image. At the same time, you may want to get the metrics for multiple domains.

So there is no simple solution even with the regexp support (thanks for it!!!) of #4 and #6. If you want a 'portable' container that you can deploy in any environment of yours with flexible options, you want target and 'target2' as parameters received from Prometheus (if this is even possible).

The support for aws_dimensions_select and aws_dimensions_select_regex has still some constraints, e.g. you cannot mix a aws_dimensions_select value (target) for the domain and a aws_dimensions_select_regex ([0-9]+) for the clientid which could have done the trick (cost of an extra AWS call on each exporter call to the list of values when you use a regexp or no value at all (interpreted as .*).
Hard-coding a list of values like

aws_dimensions_select:
  ClientId: [1234, 4654, 9545]

(the IDs of your accounts) does not work either with on the next line Domain: [$_target] and in any case we would make more AWS calls than needed.

The only solution that I have found, trying many ones is to declare the two-dimension metric and to not specify any value. It work but because of the price is 1 AWS call to get a list of client IDs (only one is returned) plus 1 AWS call to get a list of domains (let say returns N domains). Then you make 1xN individual calls so a total of 2+N AWS calls.
If you could pass target + 'target2' you would make 1 AWS call.

Other metrics may have the same problem but this one was one that I required to get.
I think that it is a good case for a 'target2' parameter if this is doable.

Thanks for this project.

@a-teisseire
Copy link
Contributor

Hi Olivier, I have written a bit of code on my side, are you still interested in this feature ?

@odupuy
Copy link
Author

odupuy commented Apr 18, 2018

Hi @a-teisseire ,
I have moved to a different project but I may have a few cycles for testing. Is it what you think about? Developing is another story as I hardly read Go.

@fas3r
Copy link

fas3r commented Jun 21, 2018

Hello @a-teisseire ,

I'm interested in that feature. Did you have a chance to release something ?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants