Skip to content
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

Collect cloud metadata #823

Merged
merged 2 commits into from Oct 2, 2020
Merged

Collect cloud metadata #823

merged 2 commits into from Oct 2, 2020

Conversation

axw
Copy link
Member

@axw axw commented Sep 30, 2020

Add support for fetching cloud metadata for AWS, Azure, and GCP.
Based on the Python reference implementation: elastic/apm-agent-python#826

By default we attempt to sniff metadata for all cloud providers. This
can be overridden by setting the environment variable
ELASTIC_APM_CLOUD_PROVIDER to one of:
"none", "aws", "azure", or "gcp".

We set a short (100ms) socket connect timeout, and a slightly longer
overall timeout (1s) for fetching the cloud metadata.

In tests we disable cloud metadata fetching by default. There are
currently no functional tests, as that would rely on us running in a
known cloud environment.

The PR has been manually tested in Google Compute Engine and
Google Cloud Run. Otherwise we're relying on the test data from
the Python agent.

Closes #786

@apmmachine
Copy link
Collaborator

apmmachine commented Sep 30, 2020

💚 Build Succeeded

Pipeline View Test View Changes Artifacts preview

Expand to view the summary

Build stats

  • Build Cause: [Pull request #823 updated]

  • Start Time: 2020-10-02T03:30:42.542+0000

  • Duration: 22 min 5 sec

Test stats 🧪

Test Results
Failed 0
Passed 7532
Skipped 182
Total 7714

@axw axw force-pushed the cloud-metadata branch 4 times, most recently from eb26594 to ebec958 Compare October 1, 2020 04:31
Based on the Python reference implementation:
elastic/apm-agent-python#826

By default we attempt to sniff metadata for all cloud
providers. This can be overridden by setting the
environment variable ELASTIC_APM_CLOUD_PROVIDER to one
of "none", "aws", "azure", or "gcp".

We set a short (100ms) socket connect timeout, and a
slightly longer overall timeout (1s) for fetching the
cloud metadata.

In tests we disable cloud metadata fetching by default.
There are currently no functional tests, as that would
rely on us running in a known cloud environment.
@axw axw requested a review from a team October 1, 2020 07:05
@axw axw marked this pull request as ready for review October 1, 2020 07:05
Copy link
Contributor

@jalvz jalvz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

code looks great!

internal/apmcloudutil/provider.go Show resolved Hide resolved
@axw axw merged commit cafdba1 into elastic:master Oct 2, 2020
@axw axw deleted the cloud-metadata branch October 2, 2020 05:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Collect cloud metadata
3 participants