Skip to content
This repository was archived by the owner on Feb 6, 2026. It is now read-only.

feat: implement revised version of the monitored resource type discovery and metadata population#708

Merged
minherz merged 4 commits intomainfrom
minherz/fix-685
Oct 14, 2021
Merged

feat: implement revised version of the monitored resource type discovery and metadata population#708
minherz merged 4 commits intomainfrom
minherz/fix-685

Conversation

@minherz
Copy link
Contributor

@minherz minherz commented Oct 12, 2021

Implement more robust resource type discovery including support for Cloud Function resource. Cache results per pair of the project id and resource type.
Refactor MonitoredResourceUtil.java to allow mocking static methods that read environment variables and metadata server attributes by using ResourceTypeEnvironmentGetter class.
Implement unit testing of the MonitoredResourceUtil.getResource() for each detected environment.

Fixes #685

@minherz minherz requested review from a team October 12, 2021 16:00
@product-auto-label product-auto-label bot added the api: logging Issues related to the googleapis/java-logging API. label Oct 12, 2021
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Oct 12, 2021
@minherz minherz requested a review from simonz130 October 12, 2021 16:00
@minherz minherz requested a review from losalex October 12, 2021 16:00
add caching mechanism for results.
implement updated heuristics for resource type and labels population.
refactor MonitoredResourceUtil code to allow mocking getenv() and getAttribute().
unit test each resource type with extra test for GAE FE and custom params.
Copy link

@simonz130 simonz130 left a comment

Choose a reason for hiding this comment

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

Very solid PR! Thanks!

We need to ensure that TraceEnhancer is treated correctly for AppEngine cases

@minherz minherz requested a review from simonz130 October 13, 2021 18:10
@simonz130
Copy link

Also note that we have environment tests for Run and Functions failing. Given that this PR adds Functions detection support, worth looking at the env test failure and seeing why is it failing.

@minherz
Copy link
Contributor Author

minherz commented Oct 14, 2021

Function env fails because envctl does not support "functions" environment. @daniel-sanche can you help me with checking the reasons for Cloud Run?

@minherz minherz merged commit 0592c96 into main Oct 14, 2021
@minherz minherz deleted the minherz/fix-685 branch October 14, 2021 08:21
gcf-merge-on-green bot pushed a commit that referenced this pull request Oct 20, 2021
🤖 I have created a release \*beep\* \*boop\*
---
## [3.3.0](https://www.github.com/googleapis/java-logging/compare/v3.2.0...v3.3.0) (2021-10-20)


### Features

* implement revised version of the monitored resource type discovery and metadata population ([#708](https://www.github.com/googleapis/java-logging/issues/708)) ([0592c96](https://www.github.com/googleapis/java-logging/commit/0592c96bc697a983f521c7ac51df53661c801975))


### Dependencies

* update dependency com.google.cloud:google-cloud-shared-dependencies to v2.4.0 ([#714](https://www.github.com/googleapis/java-logging/issues/714)) ([6ba9df7](https://www.github.com/googleapis/java-logging/commit/6ba9df7e0f36ea4c41d8bd45a67fa671c41d9db6))
---


This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please).
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

api: logging Issues related to the googleapis/java-logging API. cla: yes This human has signed the Contributor License Agreement.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

structured logging: revise resource type and info retrieval

3 participants