Skip to content

Conversation

@aabmass
Copy link
Member

@aabmass aabmass commented Aug 29, 2025

Which problem is this PR solving?

Moving the "official" GCP resource detector from GoogleCloudPlatform/opentelemetry-operations-js (@google-cloud/opentelemetry-resource-util on NPM) to this repo. This package will now be the official one we recommend to customers and support, rather than living in Google's repo 😃. Once this is released, we will delete the detector code out of Google's repo.

Short description of the changes

Fixes #2933

I have kept individual commits for easier review. In summary:

  • Copied the detector code and tests from GoogleCloudPlatform/opentelemetry-operations-js here, replacing the existing implementation
  • Add OpenTelemetry Authors copyright while retaining Google copyright (both are Apache 2).
  • Small tweaks to match repo style, get GcpDetectorIntegration.test.ts passing, and npm run lint:format.
  • Deleted the previous code and unit tests.

I've marked this as a breaking change, since the behavior will be different. Overall this implementation covers more environments (GCE, GKE, Cloud Run, Cloud Run (+Functions), App Engine Standard and Flex) and follows Resource SemConv. Google has an extensive E2E test suite that deploys the detector in all supported environments, which runs in GoogleCloudPlatform/opentelemetry-operations-js today. I will be updating those tests to periodically run this resource detector and make any fixes here.

For more context, see discussion on #2818.

@github-actions github-actions bot requested a review from punya August 29, 2025 23:30
@aabmass aabmass removed the request for review from punya August 29, 2025 23:31
@codecov
Copy link

codecov bot commented Aug 29, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.44%. Comparing base (bee0a66) to head (23cd7f0).
⚠️ Report is 2 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3007   +/-   ##
=======================================
  Coverage   91.44%   91.44%           
=======================================
  Files         146      146           
  Lines        8192     8192           
  Branches     1846     1846           
=======================================
  Hits         7491     7491           
  Misses        701      701           
Flag Coverage Δ
instrumentation-amqplib 91.25% <ø> (ø)
instrumentation-aws-lambda 94.66% <ø> (ø)
instrumentation-aws-sdk 86.48% <ø> (ø)
instrumentation-bunyan 98.47% <ø> (ø)
instrumentation-cassandra-driver 84.02% <ø> (ø)
instrumentation-connect 98.47% <ø> (ø)
instrumentation-cucumber 92.72% <ø> (ø)
instrumentation-dataloader 98.12% <ø> (ø)
instrumentation-dns 96.87% <ø> (ø)
instrumentation-express 98.14% <ø> (ø)
instrumentation-fastify 93.98% <ø> (ø)
instrumentation-generic-pool 40.54% <ø> (ø)
instrumentation-graphql 93.99% <ø> (ø)
instrumentation-hapi 99.06% <ø> (ø)
instrumentation-ioredis 91.08% <ø> (ø)
instrumentation-kafkajs 97.89% <ø> (ø)
instrumentation-knex 94.61% <ø> (ø)
instrumentation-koa 96.22% <ø> (ø)
instrumentation-lru-memoizer 100.00% <ø> (ø)
instrumentation-memcached 92.00% <ø> (ø)
instrumentation-mongodb 88.25% <ø> (ø)
instrumentation-mongoose 90.74% <ø> (ø)
instrumentation-mysql 93.36% <ø> (ø)
instrumentation-mysql2 95.91% <ø> (ø)
instrumentation-nestjs-core 96.11% <ø> (ø)
instrumentation-net 96.55% <ø> (ø)
instrumentation-openai 87.96% <ø> (ø)
instrumentation-oracledb 96.13% <ø> (ø)
instrumentation-pg 95.95% <ø> (ø)
instrumentation-pino 100.00% <ø> (ø)
instrumentation-redis 85.26% <ø> (ø)
instrumentation-restify 91.53% <ø> (ø)
instrumentation-router 97.16% <ø> (ø)
instrumentation-runtime-node 89.47% <ø> (ø)
instrumentation-socket.io 81.13% <ø> (ø)
instrumentation-tedious 92.10% <ø> (ø)
instrumentation-typeorm 90.50% <ø> (ø)
instrumentation-undici 91.78% <ø> (ø)
instrumentation-winston 79.60% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@aabmass aabmass removed the request for review from punya September 3, 2025 16:14
@aabmass
Copy link
Member Author

aabmass commented Sep 3, 2025

@psx95 would you mind giving a review here?

Copy link

@psx95 psx95 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

I'm assuming the newly added files are copied over from the operations repo. I noticed that probably Cloud Run Jobs are missing ?

@aabmass
Copy link
Member Author

aabmass commented Sep 4, 2025

I'm assuming the newly added files are copied over from the operations repo. I noticed that probably Cloud Run Jobs are missing ?

Yup 335091f

@pichlermarc pichlermarc added the has:owner-approval Approved by Component Owner label Sep 4, 2025
Copy link
Contributor

@david-luna david-luna left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we are still unable to suppress tracing on this detector. But it's good for now.
I'll try it once published.
ref: #2320

@aabmass
Copy link
Member Author

aabmass commented Sep 10, 2025

I think we are still unable to suppress tracing on this detector. But it's good for now.

Ya based on the discussion I don't think this problem will be solved

@pichlermarc pichlermarc enabled auto-merge (squash) September 10, 2025 16:46
@pichlermarc pichlermarc merged commit d60ff3a into open-telemetry:main Sep 10, 2025
16 checks passed
@dyladan dyladan mentioned this pull request Sep 10, 2025
@aabmass aabmass deleted the gcp-detector branch September 11, 2025 03:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extend @opentelemetry/resource-detector-gcp with support for Google Cloud Run

5 participants