Conversation
b28f4d9 to
280fe6d
Compare
mdwn
left a comment
There was a problem hiding this comment.
Before getting too far into this review, can https://pkg.go.dev/github.com/prometheus/client_golang/prometheus/promhttp be used instead?
There was a problem hiding this comment.
nit
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
api/utils/transportlogger/logger.go
Outdated
There was a problem hiding this comment.
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
There was a problem hiding this comment.
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
There was a problem hiding this comment.
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
There was a problem hiding this comment.
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
There was a problem hiding this comment.
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
There was a problem hiding this comment.
| Copyright 2021 Gravitational, Inc. | |
| Copyright 2024 Gravitational, Inc. |
280fe6d to
6fea76d
Compare
I don't think that promhttp allows to inject custom label per single client call. |
|
The PR changelog entry failed validation: Changelog entry not found in the PR body. Please add a "no-changelog" label to the PR, or changelog lines starting with |
| ExternalAPICallMetric = prometheus.NewCounterVec(prometheus.CounterOpts{ | ||
| Namespace: NamespaceTeleport, | ||
| Name: APICallStatusName, | ||
| Help: "Track calls to 3th party API", |
There was a problem hiding this comment.
| Help: "Track calls to 3th party API", | |
| Help: "Track calls to 3rd party API", |
| return | ||
| } | ||
| ExternalAPICallMetric.With(prometheus.Labels{ | ||
| endpointLabel: result.Name, |
There was a problem hiding this comment.
Doesn't this risk being very high cardinality metric if IDs etc are included in the path of requests e.g GET /v1/foo/aa-bb-cc-dd ?
What
third party integrations are hard. In OKTA integration we encounter severals problems:
Add a
http.Trasnportutil allows to collect prometheus metrics for third party API integration like OKTA allowing to give a insight about external API callsRelated:
https://github.com/gravitational/teleport.e/pull/3970
Usage:
Many REST endpoints leverage URL entry where uuid is embedded in URL:
In order to minimalist URL to known set of values transport logger provide the
method that allow to set the endpoint that will be reported in prometheus metrics:
A new context needs to be forwarded to http client via req.WithContext(ctx) or via library SDK library interface:
The transport RoundTripper wrapper will collect prometheus metrics allowing to monitor third party API integration: