How the knowledge graph processes data
The knowledge graph builds itself from the telemetry you already send. You don’t draw the graph. The knowledge graph reads the labels on your metrics to discover entities and the relationships between them, derives a standard set of key performance indicators (KPIs) for those entities, and evaluates alert rules over those KPIs to produce insights, which are signals that something needs attention.
Every stage has built-in rules that work with standard OpenTelemetry and Prometheus metrics. The knowledge graph also has built-in knowledge of common cloud platforms, runtimes, and frameworks, so it recognizes their telemetry without extra configuration. You can extend every stage with your own rules.
Stage summary
The following table summarizes what happens to a metric at each stage and how you can extend that stage.
The rest of this topic follows one metric through each stage.
Example metric
This example follows http_server_request_duration_seconds, the OpenTelemetry HTTP server histogram, for a service called checkout in the shop namespace, running in the prod environment in the us-east region. In Prometheus format, the histogram arrives as _bucket, _sum, and _count series. Each series carries the labels its source attached, for example:
http_server_request_duration_seconds_count{
service_name="checkout", service_namespace="shop",
http_request_method="POST", http_route="/cart/{id}",
http_response_status_code="503"
}Stage 1: Ingest metrics
The metric reaches your stack with the labels its source attached. The source can be an OpenTelemetry SDK, the OpenTelemetry Collector, Grafana Alloy, a Prometheus scraper, or metrics that Grafana Cloud generates for you. At this point, the series carries only the labels from its source, including whatever labels your telemetry uses for environment and region.
Stage 2: Normalize labels
Different sources use different names for the same idea. As each series is written, the knowledge graph fills in a small set of standard labels. It only fills a label when it’s empty, so any value you set yourself is kept.
The asserts_ prefix marks a label as internal to the knowledge graph. The asserts_env and asserts_site labels split one graph into environments, such as prod and staging, and sites, such as us-east, while keeping everything in a single graph so you can compare across environments.
You can set asserts_env and asserts_site at the source or with your own relabeling. If they aren’t already on a series, the knowledge graph copies them from the labels you map when you set up your environment. You can map any existing label, so the environment and region labels your telemetry already carries are enough. To view the rules that set these labels in your stack, run gcx kg relabel-rules get.
The later stages only process series that have an asserts_env value, and skip series that don’t. OpenTelemetry application metrics are handled differently: when they carry no environment label, they fall back to asserts_env="unknown", so they’re still included. For details on how the knowledge graph chooses environment values, refer to Environment and region.
Stage 3: Discover entities
An entity is a component of your system with a type, a name, and properties. An entity rule specifies which metric to read, which labels identify the entity, and which labels become properties.
For OpenTelemetry services, the built-in rule reads the target_info series that your SDK or collector emits. The rule identifies the entity by service name, namespace, environment, and site. From the example metric, the graph holds one entity:
Service name=checkout namespace=shop env=prod site=us-east
properties: service_version, telemetry_sdk_language, deployment_environment, ...Discovery runs on a regular cycle. When an entity stops appearing in your telemetry, the knowledge graph marks it as expired instead of deleting it, so you can still see what your system looked like during a past incident.
Stage 4: Establish relationships
A relationship rule describes how to connect entities discovered in the previous stage. The rule can compare properties of two entities, or run a Prometheus query and draw one relationship for each result. A query can read a single metric or join more than one.
For example, service graph metrics produce CALLS relationships between services:
(Service checkout)-[:CALLS]->(Service payments)Relationships expire in the same way as entities.
Stage 5: Normalize KPIs
Dashboards and alerts written for individual metrics don’t scale across hundreds of technologies. For each telemetry source, the knowledge graph knows which metrics hold the request count, the error count, the request duration, and the latency histogram. It uses them to compute the same small set of KPIs for every service, and tags each result with an entity type, so one set of insight rules works for every technology.
Each KPI is computed per service over a 5-minute window:
For a classic histogram, the percentile is computed from the bucket series:
histogram_quantile(0.99, sum by (le, ...) (rate(<metric>_bucket[5m])))For a native histogram, it’s computed from the histogram series itself:
histogram_quantile(0.99, sum by (...) (rate(<metric>[5m])))To see what this looks like, take the example metric, the OpenTelemetry server duration histogram. It’s made of the metric family http_server_request_duration_seconds_[sum|count|bucket]. With the template filled in, the KPIs are:
# Request rate
rate(http_server_request_duration_seconds_count[5m])
# Error ratio
rate(http_server_request_duration_seconds_count{http_response_status_code=~"5.."}[5m])
/ rate(http_server_request_duration_seconds_count[5m])
# Average latency
rate(http_server_request_duration_seconds_sum[5m])
/ rate(http_server_request_duration_seconds_count[5m])
# p99 latency
histogram_quantile(0.99, sum by (le, ...) (rate(http_server_request_duration_seconds_bucket[5m])))The metric already reports seconds, so no unit conversion is needed. Each result is labeled with the Service entity it belongs to, checkout in shop, prod, and us-east.
To map a metric that the knowledge graph doesn’t recognize to these KPIs, refer to Map Prometheus metrics to RED KPIs. For the insights that each KPI feeds, refer to Default KPI-based insights.
Stage 6: Derive insights
Alert rules over the normalized KPIs produce insights. Insights aren’t designed to notify on-call staff. They act as the vital signs of your system, ready when you investigate. You can subscribe to specific insights if you want to use them as traditional alerts.
Each insight has a severity and a category. The categories follow the SAAFE model:
The knowledge graph attaches each insight to an entity through the same labels that identify the entity: environment, site, namespace, and service. In the example, a spike in 5xx responses from checkout in prod appears as an ErrorRatioBreach insight on that one Service entity.
For the full list of categories, refer to Insights categories. For the insights that the built-in rules raise, refer to Base rules and framework-specific rules.
How insights connect across the graph
After an insight fires, the knowledge graph:
- Attaches the insight to the graph and indexes it for search, so a single search can find both entities and their health status.
- Adds context from the graph to the insight. For example, an insight raised on a Pod is also associated with the node and the service that the Pod belongs to. Insights on short-lived entities, such as Pods, then appear on long-lived entities, such as nodes and services, which gives you a continuous timeline.
Because insights are condensed and placed in context, they’re fast to query, aggregate, correlate, and rank during root cause analysis.
Query the results
After the six stages run, you can explore entities, relationships, and insights in Grafana Cloud, or query them from scripts and agents with gcx.
To look up an entity and its properties, run:
gcx kg entities list --type Service --env prod --namespace shop --property name=checkoutTo view the insights and related entities of an entity during an incident window, run:
gcx kg entities inspect --type Service --name checkout --env prod --namespace shop \
--from 2026-10-20T09:00:00Z --to 2026-10-20T10:00:00ZTo find the services that an entity calls, run a read-only Cypher query. Every gcx kg graph query requires a literal LIMIT.
gcx kg graph query "MATCH (a:Service {name:'checkout'})-[:CALLS]->(b:Service) RETURN a, b LIMIT 25"Next steps
- To make a metric that the built-in rules don’t recognize part of the graph, refer to Add a custom metric to the knowledge graph.
- To fix missing or duplicated entities, refer to Troubleshoot data issues.


