-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Make the set of labels consistent within each metric exported by Linkerd #4102
Comments
Are |
Furthermore, are we sure this is the only set of labels that we do not apply consistently across all uses of a metric? It seems like this issue should be more broadly scoped to audit our metrics for this class of problem? |
Ignoring the names, the problem from my perspective is that we're putting data we'd like to query into the names of labels (eg |
@olix0r Auditing all metrics is a worthy goal. In practice, there's a subset of labels that are commonly used by |
I don't think a audit of all metrics will be very helpful in this regard. We include the pod labels as Prometheus labels (#3833) so all bets are off in terms of having a uniform set of labels. I don't think it's feasible, given the way that we use Prometheus. That said, I think adding |
I'd prefer |
Just brainstorming and piling on @siggy's great points about making it more k8s centric, what about:
We could continue adding things like:
|
Upon further inspection, this may be more difficult than anticipated. These labels are generated by the prometheus kubernetes relabel config from meta labels like There may be some other way to approach this that doesn't utilize prometheus relabel configs, but that seems like a much bigger undertaking and from where I'm sitting, it doesn't seem like it's worth it. Let me know if you disagree of if I've overlooked a simpler way of doing this. |
I think this should do it: # for non-ReplicaSets (DaemonSet, StatefulSet)
# __meta_kubernetes_pod_controller_kind=DaemonSet
# __meta_kubernetes_pod_controller_name=foo
# =>
# workload_kind=DaemonSet
# workload_name=foo
- source_labels: [__meta_kubernetes_pod_controller_kind]
action: replace
target_label: workload_kind
- source_labels: [__meta_kubernetes_pod_controller_name]
action: replace
target_label: workload_name
# for ReplicaSets
# __meta_kubernetes_pod_controller_kind=ReplicaSet
# __meta_kubernetes_pod_controller_name=foo-bar-123
# =>
# workload_kind=Deployment
# workload_name=foo-bar
# deplyment=foo
- source_labels: [__meta_kubernetes_pod_controller_kind]
action: replace
regex: ^ReplicaSet$
target_label: workload_kind
replacement: Deployment
- source_labels:
- __meta_kubernetes_pod_controller_kind
- __meta_kubernetes_pod_controller_name
action: replace
regex: ^ReplicaSet;(.*)-[^-]+$
target_label: workload_name |
Good call, @siggy, I think you're right. See also linkerd/rfc#15 for an alternative approach. |
@adleong My reading of linkerd/rfc#15 seems like it will solve for #4101, but not necessarily for this issue? Unless linkerd/rfc#15 includes proxies self-identifying their own |
@siggy they certainly could, but is it necessary? my understanding of #4101 is that if all metrics (inbound and outbound) have both a src and dst metadata, then the |
@adleong Ok, just to confirm my understanding of linkerd/rfc#15, here is what I think/hope it is proposing: Every request/response metric, exported via the proxy (not at rest in Prometheus) has the following label keys:
This implies three changes to the proxy
|
Maybe we should move this discussion over to that RFC, but yes. |
Feature Request
What problem are you trying to solve?
Make the set of labels consistent within each metric exported by Linkerd.
Per the Prometheus doc, a single metric should always be exported with the same set of labels.
Prometheus'
client_golang
enforces this requirement inprometheus.Registry
:https://github.com/prometheus/client_golang/blob/673e4a177a5816096fb34777d8006fd138dbab2f/prometheus/desc.go#L35-L39
To put it another way, the set of metrics and labels exported by the Linkerd proxy would not be permitted in
client_golang
, for example:Additionally, if we want to answer the question: "What deployments are calling my service?", we need to query Prometheus like this:
How should the problem be solved?
Introduce new labels:
workload
name
dst_workload
dst_name
Current example
Proposed example
How would users interact with this feature?
This change would be transparent, provided existing labels were maintained. It would enable users to re-export and interact with Linkerd metrics in a Prometheus-standard way. For example, "What deployments are calling my service?" becomes:
Relates to #4101.
/cc @adleong @grampelberg
The text was updated successfully, but these errors were encountered: