open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.1k stars 2.39k forks source link

Support Fetching Custom Instance Labels in GCP Resource Detection Processor #35859

Open navaneeth-c opened 1 month ago

navaneeth-c commented 1 month ago

Component(s)

processor/resourcedetectionprocessor

Is your feature request related to a problem? Please describe.

Yes, the current resourcedetection processor in the OpenTelemetry Collector does not support fetching custom instance labels (tags) from Google Cloud Platform (GCP) Compute Engine (GCE) instances. This limitation hinders our ability to enrich telemetry data with valuable metadata that is critical for observability, monitoring, and consistent tagging strategies across multi-cloud environments.

Describe the solution you'd like

I propose enhancing the GCP (GCE) detector within the resourcedetection processor to fetch custom instance labels from GCE instances. The implementation would be similar to how the EC2 and Azure detectors retrieve custom tags. The solution includes:

processors:
  resourcedetection:
    detectors: [gcp]
    gcp:
      labels:
        enabled: true
        # List of regex patterns to include specific labels
        include:
          - ".*"  # Include all labels
          - "^env$"  # Include the 'env' label
          - "^team.*$"  # Include labels starting with 'team'

Describe alternatives you've considered

No response

Additional context

Thank you for considering this feature request.

navaneeth-c commented 1 month ago

/label processor/resourcedetectionprocessor

github-actions[bot] commented 1 week ago

Pinging code owners for processor/resourcedetection: @Aneurysm9 @dashpole. See Adding Labels via Comments if you do not have permissions to add labels yourself.

dashpole commented 1 week ago

This makes sense to me. cc @aabmass @psx95 @jsuereth

I'm happy to review PRs to implement this in the resource detector.

I assume we would be able to share the same configuration as the azure and aws detectors?