Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

googlecloudexporter: add ability to write to custom MRs #38331

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

ridwanmsharif
Copy link
Member

Description

This change adds a featuregate that allows writing to custom monitored resources based on presence of the gcp.resource_type resource attribute.

The default mapping from OTel resources to MRs are used as a fallback.

To enable it, use the exporter.googlecloud.CustomMonitoredResources featuregate.

Link to tracking issue

Fixes #38102

Testing

Added unit tests

Documentation

N/A

@ridwanmsharif ridwanmsharif requested review from dashpole, jsuereth and a team as code owners March 4, 2025 04:55
@github-actions github-actions bot requested review from aabmass, psx95 and punya March 4, 2025 04:55
@ridwanmsharif ridwanmsharif force-pushed the ridwanmsharif/custom-monitored-resources branch from 138a97e to 4eb5864 Compare March 4, 2025 05:29
Fixes open-telemetry#38102

This change adds a featuregate that allows writing to custom monitored
resources based on presence of the `gcp.resource_type` resource
attribute.

The default mapping from OTel resources to MRs are used as a fallback.

To enable it, use the `exporter.googlecloud.CustomMonitoredResources` featuregate.

Signed-off-by: Ridwan Sharif <ridwanmsharif@google.com>
@ridwanmsharif ridwanmsharif force-pushed the ridwanmsharif/custom-monitored-resources branch from 4eb5864 to 6434f68 Compare March 4, 2025 06:45
resource: func() pcommon.Resource {
r := pcommon.NewResource()
r.Attributes().PutStr("gcp.resource_type", "custom_resource")
r.Attributes().PutStr("gcp.custom_resource.label1", "value1")
Copy link
Member

Choose a reason for hiding this comment

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

There is a chance of future collision with MR types and the GCP resource conventions https://github.com/open-telemetry/semantic-conventions/tree/main/docs/resource/cloud-provider/gcp

Maybe a non issue but wanted to call it out

Copy link
Contributor

Choose a reason for hiding this comment

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

The collision should not happen for custom resources since they will not be a part of the semconv. However care must be taken that strings used to represent custom MR are different from those defined in semconv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Allow setting custom monitored resources in the googlecloudexporter
5 participants