---
title: "Label conventions for entity linking | Grafana Cloud documentation"
description: "Understand which labels the knowledge graph uses to discover entities and link them across products."
---

> For a curated documentation index, see [llms.txt](/llms.txt). For the complete documentation index, see [llms-full.txt](/llms-full.txt).

# Label conventions for entity linking

The knowledge graph discovers entities and builds relationships by matching labels across the metrics that Grafana Cloud products send. When labels are inconsistent or missing, entities can’t be linked, and the topology, RCA workflows, and drill-downs that depend on those links don’t work.

Use this documentation to find the labels that matter for the products you use together. Each section covers a specific relationship type.

For the full list of required metrics and labels per product, refer to [Troubleshoot data issues](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/troubleshooting/).

## Host identity

The `host_id` label provides a stable machine identifier for hosts. It’s used for host-hours billing and for consistent host identification across products. The Linux Server and Windows Server integrations include `host_id` automatically. The value comes from [OpenTelemetry resource detection](https://opentelemetry.io/docs/specs/semconv/resource/host/), which reads the identifier from the operating system.

`host_id` requires [Grafana Alloy](https://grafana.com/docs/grafana-cloud/send-data/alloy/).

> Note
> 
> If you installed the Linux Server or Windows Server integration before `host_id` was added, update your Alloy configuration snippet to include it.

> Note
> 
> Activating the knowledge graph using Host Monitoring is currently in [public preview](https://grafana.com/docs/release-life-cycle/). Grafana Labs offers limited support, and breaking changes might occur prior to the feature being made generally available.

Host Monitoring also requires the `instance` label on `node_uname_info` (Linux/Unix) or `windows_os_info` (Windows) for entity discovery. Refer to [Configure dataset for Host Monitoring](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/manage-datasets/host-monitoring/) for the full list of required metrics and labels.

## Service identity (OpenTelemetry)

Application Observability identifies services using OpenTelemetry resource attributes. These attributes map to Prometheus labels as follows:

Expand table

| OTel resource attribute              | Prometheus label              | Example value                 |
|--------------------------------------|-------------------------------|-------------------------------|
| `service.namespace` / `service.name` | `job`                         | `production/checkout-service` |
| `service.instance.id`                | `instance`                    | Pod name, UUID, or hostname   |
| `deployment.environment.name`        | `deployment_environment_name` | `production`                  |

The `job` label concatenates `${service.namespace}/${service.name}` when `service.namespace` is defined, or uses just `service.name` when it isn’t.

The knowledge graph scopes Service entities by environment using `asserts_env`, which is derived from `deployment.environment.name` (or `deployment.environment`). A mismatch in environment labels between products is a common reason entities don’t link as expected.

For details on configuring these attributes, refer to [Set up instrumentation](https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability-kg/setup/instrumentation/).

## Service to Kubernetes workload

The knowledge graph links OpenTelemetry services to their underlying Kubernetes workloads. The link uses Kubernetes resource attributes from `target_info` or `traces_target_info` (resource attributes), matched against workload ownership derived from `kube_pod_owner` (kube-state-metrics).

The link requires the following OTel resource attributes:

Expand table

| OTel resource attribute | Purpose                                |
|-------------------------|----------------------------------------|
| `k8s.namespace.name`    | Matches the workload namespace         |
| `k8s.pod.name`          | Matches the Pod to its owning workload |
| `k8s.cluster.name`      | Identifies the cluster                 |

The result is a link from the OTel service to the Kubernetes workload Service, not to individual Pods or Nodes.

Use the [Kubernetes Attributes Processor](https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/k8sattributesprocessor/README.md) to enrich your telemetry with these attributes. For setup guidance, refer to [Kubernetes monitoring recommendations](https://grafana.com/docs/grafana-cloud/monitor-applications/application-observability/collector/grafana-alloy-kubernetes/).

## Service to service

The knowledge graph links services to each other using service graph metrics. These metrics represent the calling relationship between two services and require consistent labels on both sides.

For service-to-service links to appear:

- Both services must have service graph metrics (`traces_service_graph_request_total` and related metrics).
- The `server` label on the caller’s service graph metrics must match the target service’s `service.name`.
- The `client_deployment_environment_name` and `server_deployment_environment_name` on service graph metrics must match the `deployment_environment_name` that each service reports in `target_info`. A mismatch prevents the knowledge graph from resolving the link.

If you see an un-instrumented placeholder instead of a link to a known service, verify that the `server` value matches the target service’s name exactly and that both services report the same environment.

For services running on Kubernetes, also ensure the `k8s.namespace.name`, `k8s.pod.name`, and `k8s.cluster.name` resource attributes are present. These attributes enable the knowledge graph to link services to their Kubernetes workloads in addition to other services.

## Service to Amazon RDS

The knowledge graph links Application Observability services to Amazon RDS instances by matching `*.rds.amazonaws.com` hostname patterns in span metric and service graph metric labels.

The following labels are checked for RDS hostname patterns:

Expand table

| Metric type           | Labels checked                    |
|-----------------------|-----------------------------------|
| Service graph metrics | `client_server_address`, `server` |
| Span metrics          | `server_address`, `net_peer_name` |

No additional configuration is required if your application connects to RDS using the standard RDS endpoint hostname. The knowledge graph extracts the RDS instance identifier from the hostname and matches it against the `aws_rds_info` metric.

For the full list of metrics and labels, refer to [Amazon RDS relationships](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/troubleshooting/#amazon-rds-relationships).

## Database to cloud provider

The knowledge graph can link Database Observability entities to their cloud provider counterparts (AWS RDS, Google Cloud SQL, Azure Flexible Server). It parses the database connection string to identify the cloud provider and resource, then matches it against cloud provider metrics.

### Required labels

Database Observability requires the `instance` label in `hostname:port` format. For example, `mydb.example.com:5432`, not `mydb` or `mydb.example.com`.

For the full label requirements, refer to [Database Observability labels reference](https://grafana.com/docs/grafana-cloud/observe-and-act/monitor-infrastructure/database-observability/reference/labels/).

### The `dsn` label

Database Observability setup guides include an optional relabeling step that copies the exporter’s original `instance` value to a `dsn` label before the `instance` label is overwritten. The `dsn` label is used for integration with the knowledge graph.

If you want the knowledge graph to link your database entities to cloud provider entities, include the `dsn` relabeling step from your database setup guide (for example, [Set up PostgreSQL on RDS](https://grafana.com/docs/grafana-cloud/observe-and-act/monitor-infrastructure/database-observability/set-up/postgres/rds/)).

### Cloud provider labels

For cloud-hosted databases, configure the [`cloud_provider` block](https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/components/database_observability/database_observability.mysql/#cloud_provider) in your Database Observability Alloy configuration to identify the cloud resource. This block adds the following labels to your metrics:

Expand table

| Label              | Purpose                                                 |
|--------------------|---------------------------------------------------------|
| `provider_name`    | Cloud provider identifier (for example, `aws`, `azure`) |
| `provider_account` | Cloud account or subscription identifier                |
| `provider_region`  | Cloud region where the database runs                    |

### Cloud provider linking

The knowledge graph uses the connection information in the `dsn` label to match database entities with cloud provider entities:

Expand table

| Cloud provider        | Hostname pattern          | Matched against               |
|-----------------------|---------------------------|-------------------------------|
| AWS RDS               | `*.rds.amazonaws.com`     | `aws_rds_info` metric         |
| Google Cloud SQL      | Cloud SQL connection name | Cloud SQL metrics             |
| Azure Flexible Server | `*.database.azure.com`    | Azure Flexible Server metrics |

## Host to AWS EC2

If a host runs on AWS EC2, you can link it to the corresponding EC2 entity in the knowledge graph. This requires an `instance_id` label on your host metrics.

Use the Alloy [`discovery.ec2`](https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/components/discovery/discovery.ec2/) and [`prometheus.enrich`](https://grafana.com/docs/grafana-cloud/send-data/alloy/reference/components/prometheus/prometheus.enrich/) components to add the `instance_id` label. For an example configuration, refer to [Enrich and link hosts using metadata](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/manage-datasets/host-monitoring/#enrich-and-link-hosts-using-metadata).

## Cloud provider entities

Cloud provider entities discovered through [Cloud Provider Observability](https://grafana.com/docs/grafana-cloud/monitor-infrastructure/monitor-cloud-provider/) require provider-specific scoping labels on their metrics. The knowledge graph infers its internal scoping (`asserts_env` and `asserts_site`) from these labels.

Expand table

| Cloud provider | Required scoping labels                                                |
|----------------|------------------------------------------------------------------------|
| AWS            | `account_id`, `region`                                                 |
| Azure          | `subscriptionName`, `region`                                           |
| GCP            | `project_id`, `location` (or `region` or `zone` depending on resource) |

Each cloud provider also uses a different label for entity identification:

Expand table

| Cloud provider | Identification label             | Value                                |
|----------------|----------------------------------|--------------------------------------|
| AWS            | `name`                           | Amazon Resource Name                 |
| Azure          | `resourceName`                   | Azure resource name                  |
| GCP            | `instance_name` or `database_id` | Instance name or database identifier |

For the full list of required metrics and labels per cloud provider, refer to the [AWS](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/troubleshooting/#aws-troubleshooting), [Azure](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/troubleshooting/#azure-troubleshooting), and [GCP](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/troubleshooting/#google-cloud-troubleshooting) troubleshooting sections.

## Known limitations

The following entity linking capabilities are not yet available:

- **Host to service linking**: The knowledge graph can’t yet link a non-Kubernetes host to the services running on it.
- **Bare metal logs correlation**: Logs correlation for non-Kubernetes hosts isn’t supported. For Kubernetes and OpenTelemetry services, you can configure [logs correlation](https://grafana.com/docs/grafana-cloud/knowledge-graph/configure/telemetry-correlation/logs/) to map entity properties to Loki labels.

## Next steps

- Review [Troubleshoot data issues](https://grafana.com/docs/grafana-cloud/knowledge-graph/get-started/troubleshooting/) for the full list of required metrics and labels
- Configure [telemetry correlation](https://grafana.com/docs/grafana-cloud/knowledge-graph/configure/telemetry-correlation/) for logs, traces, and profiles drill-downs
- If entities aren’t linking as expected, refer to [Connect services across products](https://grafana.com/docs/grafana-cloud/knowledge-graph/use-cases/connect-services-across-products/) for troubleshooting steps
