Conversation
ac1806d to
0cbf481
Compare
a0b1958 to
d4ba9f7
Compare
This add some code to dinamically filter the available resource detectors in order to avoid any eventual costly detection.
d4ba9f7 to
4af2bf8
Compare
xrmx
commented
Dec 2, 2024
trentm
approved these changes
Dec 2, 2024
Comment on lines
+53
to
+65
| def get_cloud_resource_detectors(): | ||
| """Helper to get a subset of the available cloud resource detectors depending on the environment | ||
|
|
||
| This is done to avoid loading resource detectors doing HTTP requests for metadata that will fail""" | ||
| if _on_aws_lambda(): | ||
| return AWS_LAMBDA_DETECTORS | ||
| elif _on_azure_functions(): | ||
| return AZURE_FUNCTIONS_DETECTORS | ||
| elif _on_gcp_cloud_run(): | ||
| return GCP_CLOUD_RUN_DETECTORS | ||
| elif _on_k8s(): | ||
| return KUBERNETES_DETECTORS | ||
| return OTHER_CLOUD_DETECTORS |
| [project.entry-points.opentelemetry_resource_detector] | ||
| process_runtime = "elasticotel.sdk.resources:ProcessRuntimeResourceDetector" | ||
| telemetry_distro = "elasticotel.sdk.resources:TelemetryDistroResourceDetector" | ||
| _gcp = "opentelemetry.resourcedetector.gcp_resource_detector._detector:GoogleCloudResourceDetector" |
Member
There was a problem hiding this comment.
I'm curious why the leading underscore. Is it because of the _detector sub-package import?
Member
Author
There was a problem hiding this comment.
It's because I'm defining the entry point here while it should really be the package with the resource detector doing it 😓
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this pull request do?
This add some code to dinamically filter the available resource detectors in order to avoid any eventual costly detection.
Related issues
Closes #23