opentelemetry-go-contrib icon indicating copy to clipboard operation
opentelemetry-go-contrib copied to clipboard

gcp: Cloud Run Application details are not labeled on traces

Open ahmetb opened this issue 4 years ago • 1 comments
trafficstars

I am opening this issue because of this file that does Cloud Run detection https://github.com/open-telemetry/opentelemetry-go-contrib/blob/f2fb9c8d5524abba85c87ef341d707c7a8173932/detectors/gcp/cloud-run.go#L95-L105 Please migrate the issue to the right repo if that's wrong.

Right now, it seems that the traces are exported (from libraries such as otelgrpc or otelmux) do not properly label the Cloud Run service details such as:

  • service name
  • service revision (a Cloud Run concept)
  • region (a GCP concept)
  • project ID (a GCP concept)

as a result, the Google Cloud Trace UI shows something like this which is not linking back to the Cloud Run service properly:

image

I expected to get labels out of the trace spans that contain the application info

ahmetb avatar Jun 09 '21 00:06 ahmetb

I was able to get this to work when I tried it. See https://github.com/GoogleCloudPlatform/golang-samples/compare/main...dashpole:opentelemetry_demo#diff-5351ce38b44519584b4f0959dc4095b977aa13372f7873f3d82f8c70daf85236R65-R68 for how to use the resource detector. Are you installing the cloud run detector?

In my service's logs, when I send a request to the service, I get this:

...
Resource: [
  0: {
    Key: "cloud.account.id"
    Value: {
      Type: "STRING"
      Value: "<project id>"
    }}
  1: {
    Key: "cloud.provider"
    Value: {
      Type: "STRING"
      Value: "gcp"
    }}
  2: {
    Key: "cloud.region"
    Value: {
      Type: "STRING"
      Value: "projects/<project number>/regions/us-east1"
  }}
  3: {
    Key: "service.instance.id"
    Value: {
      Type: "STRING"
      Value: "<ID>"
  }}
  4: {
    Key: "service.name"
    Value: {
      Type: "STRING"
      Value: "helloworld"
  }}
  5: {
    Key: "service.namespace"
    Value: {
      Type: "STRING"
      Value: "cloud-run-managed"
  }}
]

dashpole avatar Feb 10 '22 22:02 dashpole

Feel free to reopen if you have further qustions

dashpole avatar Jan 31 '24 20:01 dashpole