Skip to content

Commit

Permalink
Add fallback scrape protocol and UTF8 validation scheme to TestLabelN…
Browse files Browse the repository at this point in the history
…ameLimitConfig

Signed-off-by: Arthur Silva Sens <arthursens2005@gmail.com>
  • Loading branch information
ArthurSens committed Jan 21, 2025
1 parent a54fad2 commit cabc448
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions receiver/prometheusreceiver/metrics_receiver_labels_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ package prometheusreceiver
import (
"testing"

"github.com/prometheus/common/model"
promconfig "github.com/prometheus/prometheus/config"
"github.com/prometheus/prometheus/model/labels"
"github.com/prometheus/prometheus/model/relabel"
"github.com/stretchr/testify/require"
Expand Down Expand Up @@ -232,6 +234,10 @@ test_counter0{label1="value1",label2="value2"} 1
`

func TestLabelNameLimitConfig(t *testing.T) {
scheme := model.NameValidationScheme
model.NameValidationScheme = model.UTF8Validation
defer func() { model.NameValidationScheme = scheme }()

targets := []*testData{
{
name: "target1",
Expand All @@ -252,6 +258,7 @@ func TestLabelNameLimitConfig(t *testing.T) {
testComponent(t, targets, nil, func(cfg *PromConfig) {
// set label limit in scrape_config
for _, scrapeCfg := range cfg.ScrapeConfigs {
scrapeCfg.ScrapeFallbackProtocol = promconfig.PrometheusText1_0_0
scrapeCfg.LabelNameLengthLimit = 20
}
})
Expand Down

0 comments on commit cabc448

Please sign in to comment.