Skip to content

[processor/resourcedetection] support instance labels into GCP resourcedetection processor#41919

Merged
ChrsMark merged 50 commits intoopen-telemetry:mainfrom
paulojmdias:feat/35859
Feb 3, 2026
Merged

[processor/resourcedetection] support instance labels into GCP resourcedetection processor#41919
ChrsMark merged 50 commits intoopen-telemetry:mainfrom
paulojmdias:feat/35859

Conversation

@paulojmdias
Copy link
Copy Markdown
Member

@paulojmdias paulojmdias commented Aug 12, 2025

Description

This change adds support for detecting Google Compute Engine (GCE) instance labels and including them as resource attributes in the same way AWS EC2 and Azure detectors already do.

When running on GCE, the resource detection processor can now fetch instance labels from the Compute API (if label key regex patterns are configured) and attach them to the emitted resource under the gce.labels.* namespace.

While implementing this, I considered splitting the GCE-specific detection logic into its own dedicated package (similar to the existing AWS EC2 detector structure) to improve maintainability. This could be addressed in a follow-up PR if the team agrees it’s worthwhile.

Link to tracking issue

Fixes #35859

Testing

I have updated the tests to cover this case, but if you would like additional real evidence (logs, etc), please let me know.

Documentation

Updated the README.md with the permissions needed for this feature work and an example.

paulojmdias and others added 7 commits August 12, 2025 10:44
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…lector-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@paulojmdias paulojmdias marked this pull request as ready for review August 12, 2025 10:34
@paulojmdias paulojmdias requested review from a team and dashpole as code owners August 12, 2025 10:34
@github-actions github-actions Bot added the processor/resourcedetection Resource detection processor label Aug 12, 2025
@github-actions github-actions Bot requested a review from Aneurysm9 August 12, 2025 10:35
paulojmdias and others added 3 commits August 12, 2025 14:09
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…lector-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@dashpole
Copy link
Copy Markdown
Contributor

@braydonk @ridwanmsharif @psx95 @quentinmit
Can one of you take a look while i'm out?

paulojmdias and others added 4 commits August 12, 2025 14:42
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…lector-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Comment thread processor/resourcedetectionprocessor/internal/gcp/gcp.go Outdated
Comment thread processor/resourcedetectionprocessor/internal/gcp/gcp.go Outdated
Comment thread processor/resourcedetectionprocessor/README.md Outdated
Comment thread processor/resourcedetectionprocessor/internal/gcp/gcp.go Outdated
paulojmdias and others added 4 commits August 12, 2025 21:44
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…lector-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@paulojmdias
Copy link
Copy Markdown
Member Author

/label -stale never-stale

@github-actions github-actions Bot removed the Stale label Sep 11, 2025
@atoulme atoulme added never stale Issues marked with this label will be never staled and automatically removed waiting-for-code-owners labels Sep 21, 2025
…-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…lector-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
paulojmdias and others added 2 commits October 13, 2025 21:00
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@paulojmdias
Copy link
Copy Markdown
Member Author

@dashpole, can you please take a look at this and let me know if it makes sense to support it?

I can resolve the conflicts after it. Otherwise, maybe makes sense to close the issue as not planned 🙏

But sincerely, I see value in this. I personally use the ec2 one, and it makes it easier to correlate and identify the data ownership.

Comment thread processor/resourcedetectionprocessor/README.md Outdated
paulojmdias and others added 5 commits February 2, 2026 22:12
…-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@paulojmdias
Copy link
Copy Markdown
Member Author

/rerun

paulojmdias and others added 4 commits February 3, 2026 08:52
…-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
…lector-contrib into feat/35859

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
@paulojmdias paulojmdias added the ready to merge Code review completed; ready to merge by maintainers label Feb 3, 2026
@ChrsMark ChrsMark merged commit 888cd8f into open-telemetry:main Feb 3, 2026
207 checks passed
@paulojmdias paulojmdias deleted the feat/35859 branch February 3, 2026 11:36
ajimenez1503 pushed a commit to ajimenez1503/opentelemetry-collector-contrib that referenced this pull request Feb 4, 2026
…cedetection processor (open-telemetry#41919)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

This change adds support for detecting Google Compute Engine (GCE)
instance labels and including them as resource attributes in the same
way AWS EC2 and Azure detectors already do.

When running on GCE, the resource detection processor can now fetch
instance labels from the Compute API (if label key regex patterns are
configured) and attach them to the emitted resource under the
gce.labels.* namespace.

While implementing this, I considered splitting the GCE-specific
detection logic into its own dedicated package (similar to the existing
AWS EC2 detector structure) to improve maintainability. This could be
addressed in a follow-up PR if the team agrees it’s worthwhile.

<!-- Issue number (e.g. open-telemetry#1234) or full URL to issue, if applicable. -->
#### Link to tracking issue
Fixes open-telemetry#35859

<!--Describe what testing was performed and which tests were added.-->
#### Testing

I have updated the tests to cover this case, but if you would like
additional real evidence (logs, etc), please let me know.

<!--Describe the documentation added.-->
#### Documentation

Updated the README.md with the permissions needed for this feature work
and an example.

<!--Please delete paragraphs that you did not use before submitting.-->

---------

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
mx-psi pushed a commit that referenced this pull request Feb 4, 2026
…ease GCE labels test coverage (#45852)

<!--Ex. Fixing a bug - Describe the bug and how this fixes the issue.
Ex. Adding a feature - Explain what this achieves.-->
#### Description

After my PR
#41919
was merged, I feel some improvements could be made related to it.

This PR does not change any behaviour for the users and includes the
following changes:
- Un-export `GCElabelPrefix` renaming it to `gceLabelPrefix`
- Update log format when reading metadata for labels fails
- Increase test coverage, including using invalid regex patterns

---------

Signed-off-by: Paulo Dias <paulodias.gm@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

connector/datadog exporter/datadog Datadog components internal/datadog/e2e internal/e2e never stale Issues marked with this label will be never staled and automatically removed processor/resourcedetection Resource detection processor ready to merge Code review completed; ready to merge by maintainers waiting-for-code-owners

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Fetching Custom Instance Labels in GCP Resource Detection Processor

7 participants