59c00e3e9c
This commit fixes a data race that exists when the metric used in any `promhttp` middleware doesn't collect the `code` and `method` but uses `WithLabelFromCtx` to collect values from context. The problem happens because when no `code` and `method` tags are collected, the `labels` function returns a pre-initialized map `emptyLabels` for every request. When one or multipe `WithLabelFromCtx` options are configured, the returned map from the `labels` function call is used to collect the metrics from context which creates a multi-write data race. Signed-off-by: Tiago Silva <tiago.silva@goteleport.com> |
||
---|---|---|
.. | ||
delegator.go | ||
http.go | ||
http_test.go | ||
instrument_client.go | ||
instrument_client_test.go | ||
instrument_server.go | ||
instrument_server_test.go | ||
option.go | ||
option_test.go |