Skip to content
This repository has been archived by the owner on Nov 5, 2021. It is now read-only.

additional_label's are missing in custom metrics of EXTERNAL probe #654

Closed
skuethe opened this issue Aug 25, 2021 · 3 comments
Closed

additional_label's are missing in custom metrics of EXTERNAL probe #654

skuethe opened this issue Aug 25, 2021 · 3 comments
Assignees
Labels
Milestone

Comments

@skuethe
Copy link

skuethe commented Aug 25, 2021

First off, thank you for providing this very useful tool! :)

Describe the bug
It seems that any additional_label defined inside an EXTERNAL probe only applies to the build-in metrics (success, total and latency). Any custom metrics returned by the external probe does not have these labels set.

Cloudprober Version
Tested both v0.11.2 and latest master (as of today: 2021-08-25)

To Reproduce
I have an external probe which calls Azure API and returns additional data about the remaining API rate limits (which are send by Azure in the HTTP Header). For example Microsoft_Compute_LowCostGet30Min.
These custom metrics are exposed and scraped successfully, but the labels are missing. My probe configuration looks like this:

probe {
  name: "azure_vms"
  type: EXTERNAL

  [...]

  external_probe {
    mode: ONCE
    command: "azureapiprobe --vmname @target@ --rgname @target.label.rgname@"
  }
  additional_label {
    key: "rgname"
    value: "@target.label.rgname@"
  }
  additional_label {
    key: "os"
    value: "@target.label.os@"
  }
}

Example output:

## These are fine:

#TYPE cloudprober_success counter
cloudprober_success{ptype="external",probe="azure_vms",dst="TARGETNAME",rgname=RGNAME,os="linux"} 2 1629904383080
#TYPE cloudprober_total counter
cloudprober_total{ptype="external",probe="azure_vms",dst="TARGETNAME",rgname=RGNAME,os="linux"} 2 1629904383080
#TYPE cloudprober_latency counter
cloudprober_latency{ptype="external",probe="azure_vms",dst="TARGETNAME",rgname=RGNAME,os="linux"} 896401.042 1629904383080

## This is missing the `rgname` and `os` labels:

#TYPE cloudprober_ratelimit_Microsoft_Compute_LowCostGet30Min gauge
cloudprober_ratelimit_Microsoft_Compute_LowCostGet30Min{ptype="external",probe="azure_vms",dst="TARGETNAME"} 31779.000 1629904383080
@skuethe skuethe added the bug label Aug 25, 2021
@manugarg manugarg added this to the v0.11.3 milestone Aug 26, 2021
@manugarg manugarg self-assigned this Aug 26, 2021
manugarg added a commit that referenced this issue Aug 26, 2021
Also, update tests to verify that additional labels are being attached.

Ref: #654
PiperOrigin-RevId: 393196944
manugarg added a commit that referenced this issue Aug 27, 2021
Also, update tests to verify that additional labels are being attached.

Ref: #654
PiperOrigin-RevId: 393196944
@manugarg
Copy link
Contributor

Above change should fix this issue. You can test it with the "master" tag docker image. It will be released with the v0.11.3 release.

@manugarg
Copy link
Contributor

Closing this issue now. Please feel free to reopen if it doesn't work. You can track the release here:
https://github.com/google/cloudprober/milestone/11

@skuethe
Copy link
Author

skuethe commented Aug 27, 2021

Works like a charm. Thank you @manugarg!

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

No branches or pull requests

2 participants