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

fix(resource-detector): properly detect zone on AppEngine standard #715

Merged
merged 2 commits into from
May 7, 2024

Conversation

aabmass
Copy link
Contributor

@aabmass aabmass commented May 3, 2024

Fixes #655

It turns out GAE standard environment's metadata server returns a zone string like projects/myproject/zones/us15. ut integration tests only run on AppEngine flex not standard so this wasn't caught 🙁. Here are HTTP logs I printed out from a sample app:

{
  "jsonPayload": {
    "message": "gaxios metadata request",
    "responseData": "projects/<project>/zones/us15",
    "requestUrl": "http://169.254.169.254/computeMetadata/v1/instance/zone"
  },
  "resource": {
    "type": "gae_app",
    "labels": {
      "zone": "us15",
      "version_id": "20240503t222051",
      "project_id": "otel-starter-project",
      "module_id": "default"
    }
  }
}

I updated the tests and manually tested a sample app on GAE standard writing metrics:
image


I think this bug is also affecting all other resource detectors e.g. Go's impl that this was copied from

@aabmass aabmass requested a review from a team as a code owner May 3, 2024 22:34
@psx95
Copy link
Contributor

psx95 commented May 4, 2024

Summary for this issue in other language detectors:

Copy link
Contributor

@psx95 psx95 left a comment

Choose a reason for hiding this comment

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

Nit: The console.log statements could be removed.

The change looks good.

@aabmass
Copy link
Contributor Author

aabmass commented May 6, 2024

I think it does have the issue. This test doesn't provide the slash separated string for GAE standard and the detector just returns the zone directly

@aabmass aabmass requested a review from psx95 May 6, 2024 14:59
@psx95
Copy link
Contributor

psx95 commented May 6, 2024

I think it does have the issue. This test doesn't provide the slash separated string for GAE standard and the detector just returns the zone directly

We might need to add a test to prevent regression, but going by the implementation of metadataConfig.getZone(), it does not look like there would be an issue as it is similar to what is being done in this fix.

@aabmass
Copy link
Contributor Author

aabmass commented May 7, 2024

We might need to add a test to prevent regression, but going by the implementation of metadataConfig.getZone(), it does not look like there would be an issue as it is similar to what is being done in this fix.

Here is a test update GoogleCloudPlatform/opentelemetry-operations-java#341 thanks

@aabmass aabmass merged commit 98b81dd into GoogleCloudPlatform:main May 7, 2024
19 checks passed
@aabmass aabmass deleted the detect-gae-standard branch May 7, 2024 03:02
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.

Cloud monitoring export reports "invalid location or region" in GAE nodejs20
3 participants