Skip to content

Commit

Permalink
feat: travelaudience#7 - Create instrumented client with more than on…
Browse files Browse the repository at this point in the history
…e const label

Signed-off-by: grzesuav <[email protected]>
  • Loading branch information
grzesuav committed Jul 26, 2021
1 parent 249c7bf commit eea403f
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ func (c *Client) ForRecipient(recipient string) (*http.Client, error) {
})
}

// ForConstLabels allocates new client based on base one with incomingInstrumentation.
// Given constLabels is used as a constant label.
func (c *Client) ForConstLabels(constLabels map[string]string) (*http.Client, error) {
return instrumentClientWithConstLabels(c.Namespace, c.Client, c.Registerer, constLabels)
}

func instrumentClientWithConstLabels(namespace string, c *http.Client, reg prometheus.Registerer, constLabels map[string]string) (*http.Client, error) {
i := &outgoingInstrumentation{
requests: prometheus.NewCounterVec(
Expand Down

0 comments on commit eea403f

Please sign in to comment.