Expose for Prometheus and push to a collector
MeshMetric accepts more than one backend, so you can scrape and push the same metrics at the same time.
Configuration
apiVersion: kuma.io/v1alpha1
kind: MeshMetric
metadata:
name: backend-two-backends
namespace: kong-mesh-demo
labels:
kuma.io/mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
backends:
- type: Prometheus
prometheus:
port: 5670
- type: OpenTelemetry
openTelemetry:
backendRef:
kind: MeshOpenTelemetryBackend
labels:
kuma.io/display-name: otel-collectorCopied!
type: MeshMetric
name: backend-two-backends
mesh: default
spec:
targetRef:
kind: Dataplane
labels:
app: backend
default:
backends:
- type: Prometheus
prometheus:
port: 5670
- type: OpenTelemetry
openTelemetry:
backendRef:
kind: MeshOpenTelemetryBackend
labels:
kuma.io/display-name: otel-collectorCopied!
Adjust konnect_mesh_control_plane.my_meshcontrolplane.id and konnect_mesh.my_mesh.name according to your current configuration.
resource "konnect_mesh_metric" "backend_two_backends" {
provider = konnect-beta
type = "MeshMetric"
name = "backend-two-backends"
spec = {
target_ref = {
kind = "Dataplane"
labels = {
app = "backend"
}
}
default = {
backends = [
{
type = "Prometheus"
prometheus = {
port = 5670
}
},
{
type = "OpenTelemetry"
open_telemetry = {
backend_ref = {
kind = "MeshOpenTelemetryBackend"
labels = {
"kuma.io/display-name" = "otel-collector"
}
}
}
}
]
}
}
labels = {
"kuma.io/mesh" = konnect_mesh.my_mesh.name
}
cp_id = konnect_mesh_control_plane.my_meshcontrolplane.id
mesh = konnect_mesh.my_mesh.name
}
Copied!