I have a Flask app programmatically instrumented using opentelemetry, like this
https://opentelemetry.io/docs/instrumentation/python/automatic/example/#programmatically-instrumente...
This results in both traces being generated and metrics being generated.
I have also configured the trace provider to export the trace using the CloudTraceSpanExporter, like this
Python and OpenTelemetry | Cloud Trace | Google Cloud
This app is deployed as a deployment in a GKE Cluster. I can successfully view the traces in Google Cloud Trace.
How can I also view the opentelemetry metrics in Google Cloud Monitoring? What is the simplest solution? What is the least costly solution?
I see a daemonset gke-metrics-agent that appears to scrape the metrics endpoint for the local kubelet. Can the configuration of that agent be modified to support scraping from other sources as well?
Hi @VictorNEE
Welcome to Google Cloud Community!
For you to be able to export your app metrics (OTLP) going to Cloud Monitoring, you need to install OpsAgent and modify the config.yaml as follows:
combined:
receivers:
otlp:
type: otlp
metrics_mode: googlecloudmonitoring
You can learn more about this on the official documentation via this link as well as this sample modification.
In addition, you can also follow this link for example implementation using Python code.
I hope this information is helpful. Please let me know if you have any other questions.
Hello Ron!
Something I'm confused about is that in this doc it says "The following types of VM instances belong to managed services that implement service-specific Monitoring support. Don't try to manually install or configure the Ops Agent on them" and it includes GKE as one of those managed services.
https://cloud.google.com/monitoring/agent/ops-agent#supported_vms
Are you saying that it is possible to configure OpsAgent to collect OTLP metrics from k8s deployments hosted within a GKE cluster?