Labels reference
Labels identify and organize your database telemetry data. This reference documents all labels used by Database Observability, their requirements, and best practices.
Required labels
These labels must be configured correctly for Database Observability to function.
job
The job label identifies Database Observability telemetry.
Configuration:
loki.relabel "mydb" {
forward_to = [loki.write.default.receiver]
rule {
target_label = "job"
replacement = "integrations/db-o11y"
}
}
discovery.relabel "mydb" {
targets = database_observability.postgres.mydb.targets
rule {
target_label = "job"
replacement = "integrations/db-o11y"
}
}Warning
If
jobis not exactlyintegrations/db-o11y, the Database Observability dashboards cannot find your data.
instance
The instance label uniquely identifies each database server.
Configuration:
loki.relabel "mydb" {
forward_to = [loki.write.default.receiver]
rule {
target_label = "instance"
replacement = "db.example.com:5432"
}
}
discovery.relabel "mydb" {
targets = database_observability.postgres.mydb.targets
rule {
target_label = "instance"
replacement = "db.example.com:5432"
}
}Best practices:
For AWS RDS/Aurora:
Use the instance endpoint, not the cluster endpoint:
// Correct - instance endpoint
instance = "mydb-instance.abcd1234.us-east-1.rds.amazonaws.com:5432"
// Incorrect - cluster endpoint (changes during failover)
instance = "mydb-cluster.cluster-abcd1234.us-east-1.rds.amazonaws.com:5432"System-managed labels
These labels are set automatically by Alloy. Do not modify them.
Warning
Do not override
server_idoropin relabel rules. Modifying these labels prevents Database Observability from querying and correlating your data.
Database-specific labels
These labels come from the database itself and are automatically added by exporters.
PostgreSQL labels
MySQL labels
Recommended custom labels
Add these labels in both loki.relabel and discovery.relabel to organize and filter databases. Values must match across both components.
Example:
rule {
target_label = "app"
replacement = "order-service"
}For complete configuration examples showing custom labels in context, refer to Monitor multiple databases.
Environment variables
For dynamic labels, use environment variables:
rule {
target_label = "environment"
replacement = sys.env("DEPLOYMENT_ENV")
}
rule {
target_label = "region"
replacement = sys.env("AWS_REGION")
}Label name and value restrictions
Related documentation
- Telemetry reference: Available metrics and logs
- Monitor multiple databases: Labeling strategies and configuration at scale
- Tune Alloy collection: Configure collection and manage cardinality
- Troubleshoot Alloy components: Validate relabeling rules and diagnose label issues
- View query performance: Use labels in dashboards



