GoogleCloudPlatform / opentelemetry-operations-java

Apache License 2.0
73 stars 38 forks source link

Google-managed prometheus ingestion for metrics #259

Open lstanczak opened 1 year ago

lstanczak commented 1 year ago

Hello Java applications need to be able to export metrics using manage prometheus interface: https://cloud.google.com/stackdriver/docs/managed-prometheus

Similar solution is done for Go (and used in otel-collector) https://github.com/GoogleCloudPlatform/opentelemetry-operations-go/tree/main/exporter/collector/googlemanagedprometheus

aabmass commented 1 year ago

For now, we don't plan to support this in individual language SDK exporters. There are a few other options you could try:

Would either of these work for your use case?

lstanczak commented 1 year ago

For now, we don't plan to support this in individual language SDK exporters. There are a few other options you could try:

  • Configure the OTel Java Prometheus exporter with Google Managed Prometheus agent scraping it
  • Send OTLP to an OTel collector and use the googlemanagedprometheus exporter than you mentioned to send to Google Managed Prometheus

Would either of these work for your use case?

It would be more efficient to integrate directly. Do you know if there is a documentation for this protocol/format?

aabmass commented 1 year ago

It would be more efficient to integrate directly.

Are you using GKE or GCE? It would be good to know some more details of your use case and what you mean by "efficient" here.

Do you know if there is a documentation for this protocol/format?

We don't publicly document the format and it could be subject to change. I don't think we would want to take on maintenance of such an exporter right now, but I'll leave this open as a feature request.

evantorrie commented 6 months ago

One use-case for wanting direct integration of exporter is when running as a Cloud Function. In that case, having to deploy an Otel Collector somewhere just in order to receive the OTLP metrics and then use the Collector to translate to googlemanagedprometheus seems somewhat contrary to the promise of "serverless" code.

It would probably be better if Google Monitoring just had a direct OTLP endpoint, rather than providing googlecloud or googlemanagedprometheus endpoints.

psx95 commented 1 month ago

@evantorrie Would something like https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/377 work for you in the meantime ? (As a workaround)

The example showcase exporting metrics from a Google Cloud Run Function (formerly known as Cloud Function) to Google Managed Prometheus using an OTel Collector.

Granted it still uses an OpenTelemetry Collector, but it leverages Cloud Run's multi-container support, so you don't need to manage a separate persistent server (GCE instance or something similar) constantly running that hosts a collector.