Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
66 changes: 66 additions & 0 deletions modules/otel-forwarding-data-to-google-managed-prometheus.adoc
Original file line number Diff line number Diff line change
@@ -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.
8 changes: 8 additions & 0 deletions observability/otel/otel-forwarding-telemetry-data.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down