Skip to content

Commit

Permalink
Pull request #94: Don't have port in default blackbox scraper name
Browse files Browse the repository at this point in the history
Merge in PRODUCT/glouton from PRODUCT-1832-blackbox-default-scraper-name to master

* commit 'c08079c639695e82dcaaf011eee95f67391eae5f':
  Don't have port in default blackbox scraper name
  • Loading branch information
PierreF committed Feb 24, 2022
2 parents 5f2e842 + c08079c commit 0a20ec6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions prometheus/registry/registry.go
Original file line number Diff line number Diff line change
Expand Up @@ -262,11 +262,11 @@ func getDefaultRelabelConfig() []*relabel.Config {
TargetLabel: types.LabelScraperUUID,
Replacement: "$2",
},
// when the metric comes from a probe, the 'scraper' label is the value we usually put in the 'instance' label
// when the metric comes from a probe, the 'scraper' label is the value we usually put in the 'instance' label without port
{
Action: relabel.Replace,
Separator: ";",
Regex: relabel.MustNewRegexp("(.+);(.+)"),
Regex: relabel.MustNewRegexp("(.+);([^:]+)(:\\d+)?"),
SourceLabels: model.LabelNames{types.LabelMetaProbeServiceUUID, types.LabelInstance},
TargetLabel: types.LabelScraper,
Replacement: "$2",
Expand Down
4 changes: 2 additions & 2 deletions prometheus/registry/registry_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -503,7 +503,7 @@ func TestRegistry_applyRelabel(t *testing.T) {
BleemeoAgentID: "c571f9cf-6f07-492a-9e86-b8d5f5027557",
},
},
// when LabelMetaProbeScraperName is not provided, the 'scraper' label is the traditional 'instance' label
// when LabelMetaProbeScraperName is not provided, the 'scraper' label is the traditional 'instance' label without port
{
name: "blackbox_probe_icmp_no_scraper_name",
fields: fields{relabelConfigs: getDefaultRelabelConfig()},
Expand All @@ -518,7 +518,7 @@ func TestRegistry_applyRelabel(t *testing.T) {
}},
want: labels.FromMap(map[string]string{
types.LabelInstance: "icmp://8.8.8.8",
types.LabelScraper: "super-instance:1111",
types.LabelScraper: "super-instance",
types.LabelInstanceUUID: "c571f9cf-6f07-492a-9e86-b8d5f5027557",
types.LabelScraperUUID: "a39e5a8e-34cf-4b15-87bd-4b9cdaa59c42",
}),
Expand Down

0 comments on commit 0a20ec6

Please sign in to comment.