-
Notifications
You must be signed in to change notification settings - Fork 581
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
Unify and improve GCP resource detection, second attempt #2310
Conversation
ae4136a
to
8a4626a
Compare
Codecov Report
@@ Coverage Diff @@
## main #2310 +/- ##
=====================================
Coverage 73.6% 73.7%
=====================================
Files 141 142 +1
Lines 6384 6457 +73
=====================================
+ Hits 4704 4764 +60
- Misses 1539 1550 +11
- Partials 141 143 +2
|
f4abae8
to
cb346ca
Compare
Looks like a |
Done |
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
I know this is very old - but why did you stop detecting the pod, container, etc? Having to do this with env vars is less than ideal. Since it makes it hard to leverage the detected OTEL resources to build a unique ID for the resource like: |
@jaredjenkins can you expand on what you are unable to do? The previous detector was using environment variables to set those attributes. You can achieve the previous behavior by adding: - name: OTEL_RESOURCE_ATTRIBUTES
value: k8s.pod.name=$(HOSTNAME),k8s.namespace.name=$(NAMESPACE),k8s.container.name=$(CONTAINER_NAME) In your pod spec. k8s.* attributes are not GCP-specific, and thus don't belong in the GCP detector. |
@dashpole I hear you on the separation of concerns. Here's the context: I'm coming from a heavy Prometheus background where "resource labels" go through different stages: discovered -> available for augmentation or control flow. The latter is accomplished through a relabel rule that can be applied on scrape time. Benefit is that folks get consistent Instance IDs and can use the "resource labels" to build other labels.
We could do that using the env variables that we defined, but it's just not very ergonomic. Based on this open-telemetry/opentelemetry-specification#3136. It looks like users are still required to provide some kind of UUID, but that's honestly pretty to useless for debugging. The OTLP -> Prometheus spec will extract the You can of course try to read this data from the detectors like the GCP one, but you can't easily set |
I'm aware that we could probably perform this augmentation in the OTEL Collector - just not sure how yet (still new to this!). |
Got it, that makes sense. I think the best path forward would be #4136 |
This PR supersedes GoogleCloudPlatform/opentelemetry-operations-go#383 and #2223. It was also discussed at the May 5th sig meeting.
It implements resource detection for GCE, GKE, GAE, Cloud Run, and Cloud Functions using a single detector. The underlying logic is implemented (and integration tested in GCP environments) in GoogleCloudPlatform/opentelemetry-operations-go. The underlying library provides a function, CloudPlatform, which detects which platform it is on, and then one function for each attribute. The reason for the split between "library" and detector is so that the library functions can be integration tested in real GCP environments, which is difficult to do in upstream repositories.
Unfortunately, the current resource detector was already marked stable, so we won't be able to remove existing types, etc. I've added deprecation warnings to them to encourage users to move to the new implementation.
When users switch to the new detector, there are a few breaking changes:
Additions: