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

Support Fetching Custom Instance Labels in GCP Resource Detection Processor

Open navaneeth-c opened this issue 4 months ago • 0 comments

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:

  • Configuration Support: Introduce a new configuration option under the GCP detector to enable fetching of custom labels.
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

  • Consistency Across Cloud Providers: Both AWS and Azure detectors support fetching custom instance tags. Adding this feature to the GCP detector ensures consistent functionality across cloud providers.
  • Willingness to Contribute: I am ready to sponsor and contribute to the development of this feature, including writing code and tests, to help accelerate its implementation.
  • Benefit to the Community: This enhancement will benefit all users who deploy the OpenTelemetry Collector in GCP environments, improving the richness of telemetry data and enabling better observability practices.
  • Reference Implementation: The approach can mirror the existing implementations in the EC2 detector (https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/internal/aws/ec2/ec2.go#L134-L154) and Azure detector (https://github.com/open-telemetry/opentelemetry-collector-contrib/blob/main/processor/resourcedetectionprocessor/internal/azure/azure.go#L77-L82).

Thank you for considering this feature request.

navaneeth-c avatar Oct 17 '24 22:10 navaneeth-c