Skip to content

Service Graph Metrics mix K8s namespace and OTEL namespace #1371

@mariomac

Description

@mariomac

Scenario

4 services in the demo K8s namespace, that override the OTEL service.namespace attribute via OTEL_RESOURCE_ATTRIBUTES env var or resource.opentelemetry.io/service.namespace: "ecommerce" annotations.

Service Graph metrics duplicate the services because the server_service_namespace is duplicated as demo and ecommerce:

For example:

traces_service_graph_request_total{
  client="my-backend",
  client_service_namespace="ecommerce",
  instance="kind-worker",
  server="worker-svc",
  server_service_namespace="demo",
}
traces_service_graph_request_total{
  client="my-backend",
  client_service_namespace="ecommerce",
  instance="kind-worker2",
  server="my-worker",
  server_service_namespace="ecommerce",
}

Service Graph view:
Image

The reason is that OBI is able to correctly override the destination Pod K8s namespace by the standard OTEL env vars and annotations.

However, when the destination URL is a service (worker-svc instead of my-worker), the pod annotations and env vars are not visible from the URL.

## Possible solution

Through the Kube API, let OBI to keep track of the K8s Service spec.selector attributes and internally maintain a map of Pods that already match that attribute, then from the service name it's possible to access the Pod replicas that should share the same annotations and env vars.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions