Skip to content

Commit 4b5b827

Browse files
authored
Add useragent to headers (#34)
This adds a configuration option for the RoundTripper that sets the useragent to `grafana-kost-estimator`. This helps downstream Prometheus instances understand where the queries that are coming from. If the logs are captured by something such as loki, you can easily filter our queries sent to Prometheus by the kost bot.
1 parent 810da6e commit 4b5b827

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

pkg/costmodel/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ func NewClient(config *ClientConfig) (*Client, error) {
135135
fmt.Println("HTTP config file and basic auth not provided, using no authentication")
136136
}
137137

138-
roundTripper, err := configutil.NewRoundTripperFromConfig(*cfg, "grafana-kost-estimator", configutil.WithHTTP2Disabled())
138+
roundTripper, err := configutil.NewRoundTripperFromConfig(*cfg, "grafana-kost-estimator", configutil.WithHTTP2Disabled(), configutil.WithUserAgent("grafana-kost-estimator"))
139139
if err != nil {
140140
return nil, fmt.Errorf("error creating round tripper: %v", err)
141141
}

0 commit comments

Comments
 (0)