diff --git a/modules/otel-forwarding-data-to-google-managed-prometheus.adoc b/modules/otel-forwarding-data-to-google-managed-prometheus.adoc new file mode 100644 index 000000000000..9f2a8981abe7 --- /dev/null +++ b/modules/otel-forwarding-data-to-google-managed-prometheus.adoc @@ -0,0 +1,66 @@ +// Module included in the following assemblies: +// +// * observability/otel/otel-forwarding-telemetry-data.adoc + +:_mod-docs-content-type: CONCEPT +[id="otel-forwarding-data-to-google-managed-prometheus_{context}"] += Forwarding telemetry data to Google Managed Prometheus + +[role="_abstract"] +To forward metrics to the Google Managed Prometheus, use the OpenTelemetry Collector with the OTLP exporter, metricstarttime processor and googleclientauth extension. + +.OpenTelemetry Collector custom resource with a configured File Storage Extension that persists an OTLP sending queue +[source,yaml] +---- +# ... + mode: sidecar + config: + extensions: + googleclientauth: {} + + exporters: + otlphttp: + encoding: json + endpoint: https://telemetry.googleapis.com + auth: + authenticator: googleclientauth + + processors: + metricstarttime: + strategy: subtract_initial_point # <2> + + resource/gcp_project_id: + attributes: + - action: insert + value: project_id # <1> + key: gcp.project_id + + k8sattributes: {} + + transform/collision: + metric_statements: + - context: datapoint + statements: + - set(attributes["exported_location"], attributes["location"]) + - delete_key(attributes, "location") + - set(attributes["exported_cluster"], attributes["cluster"]) + - delete_key(attributes, "cluster") + - set(attributes["exported_namespace"], attributes["namespace"]) + - delete_key(attributes, "namespace") + - set(attributes["exported_job"], attributes["job"]) + - delete_key(attributes, "job") + - set(attributes["exported_instance"], attributes["instance"]) + - delete_key(attributes, "instance") + - set(attributes["exported_project_id"], attributes["project_id"]) + - delete_key(attributes, "project_id") + + service: + extensions: [googleclientauth] + pipelines: + metrics: + processors: [k8sattributes, resource/gcp_project_id, transform/collision, metricstarttime] + exporters: [otlphttp] +# ... +---- +<1> The `subtract_initial_point` strategy is stateful, requiring the Collector to run as a sidecar to maintain per-pod state. Alternative strategies available; choose the one that best fits your use case. +<2> Replace with your GCP project ID. \ No newline at end of file diff --git a/observability/otel/otel-forwarding-telemetry-data.adoc b/observability/otel/otel-forwarding-telemetry-data.adoc index bf86771546c4..e4cb6a372768 100644 --- a/observability/otel/otel-forwarding-telemetry-data.adoc +++ b/observability/otel/otel-forwarding-telemetry-data.adoc @@ -26,6 +26,14 @@ include::modules/otel-forwarding-data-to-google-cloud.adoc[leveloffset=+1] .Additional resources * xref:../../observability/otel/otel-collector/otel-collector-exporters.adoc#otel-collector-exporters[Exporters] +include::modules/otel-forwarding-data-to-google-managed-prometheus.adoc[leveloffset=+1] + +[role="_additional-resources"] +.Additional resources +* xref:../../observability/otel/otel-collector/otel-collector-processors.adoc#otel-collector-processors[Processors] +* xref:../../observability/otel/otel-collector/otel-collector-extensions.adoc#otel-collector-extensions[Extensions] +* https://docs.cloud.google.com/stackdriver/docs/managed-prometheus + [role="_additional-resources"] [id="additional-resources_{context}"] == Additional resources