Package gcp provides a resource detector for GCP Cloud Function environments.
Install & Compatibility
Where this runs
No compatibility data collected yet for this library.
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
go.opentelemetry.io/contrib/detectors/gcp
Detects GCP resource attributes using the GCP detector.
package main
import (
"context"
"log"
"go.opentelemetry.io/contrib/detectors/gcp"
"go.opentelemetry.io/otel/sdk/resource"
)
func main() {
ctx := context.Background()
detector := gcp.NewDetector()
res, err := detector.Detect(ctx)
if err != nil {
log.Fatal(err)
}
log.Printf("Detected resource: %v", res)
}
Debug
Known footguns
No known footguns recorded.
Upgrade
Version history
Breaking-change detection hasn't run for this library yet.
Audit
Security & dependencies
CVE tracking and dependency tree are planned for a later release.