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

Hard code expected labels on obsreport tests #1083

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions obsreport/obsreport_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,17 @@ const (

var (
errFake = errors.New("errFake")

// Names used by the metrics and labels are hard coded here in order to avoid
// inadvertent changes: at this point changing metric names and labels should
// be treated as a breaking changing and requires a good justification.
pjanotti marked this conversation as resolved.
Show resolved Hide resolved
// Changes to metric names or labels can break alerting, dashboards, etc
// that are used to monitor the Collector in production deployments.
// DO NOT SWITCH THE VARIABLES BELOW TO SIMILAR ONES DEFINED ON THE PACKAGE.
receiverTag, _ = tag.NewKey("receiver")
transportTag, _ = tag.NewKey("transport")
exporterTag, _ = tag.NewKey("exporter")
processorTag, _ = tag.NewKey("processor")
)

type receiveTestParams struct {
Expand Down Expand Up @@ -579,20 +590,20 @@ func checkValueForSumView(t *testing.T, vName string, wantTags []tag.Tag, value

func receiverViewTags(receiver, transport string) []tag.Tag {
return []tag.Tag{
{Key: tagKeyReceiver, Value: receiver},
{Key: tagKeyTransport, Value: transport},
{Key: receiverTag, Value: receiver},
{Key: transportTag, Value: transport},
}
}

func exporterViewTags(exporter string) []tag.Tag {
return []tag.Tag{
{Key: tagKeyExporter, Value: exporter},
{Key: exporterTag, Value: exporter},
}
}

func processorViewTags(processor string) []tag.Tag {
return []tag.Tag{
{Key: tagKeyProcessor, Value: processor},
{Key: processorTag, Value: processor},
}
}

Expand Down