- Notifications
You must be signed in to change notification settings - Fork 39
Add resource attributes as metric labels #314
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
Merged
psx95 merged 3 commits into GoogleCloudPlatform:main from psx95:metric-attribute-filter Mar 28, 2024
Merged
Add resource attributes as metric labels #314
psx95 merged 3 commits into GoogleCloudPlatform:main from psx95:metric-attribute-filter Mar 28, 2024
Conversation
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
e67d6f3 to d610be9 Compare psx95 commented Mar 25, 2024
exporters/metrics/src/main/java/com/google/cloud/opentelemetry/metric/MetricConfiguration.java Outdated Show resolved Hide resolved
dashpole reviewed Mar 25, 2024
...main/java/com/google/cloud/opentelemetry/metric/AggregateByLabelMetricTimeSeriesBuilder.java Show resolved Hide resolved
dashpole approved these changes Mar 28, 2024
jsuereth approved these changes Mar 28, 2024
lqiu96 referenced this pull request in googleapis/sdk-platform-java Apr 17, 2024
…rces-support to v0.28.0 (#2649) [](https://renovatebot.com) This PR contains the following updates: | Package | Change | Age | Adoption | Passing | Confidence | |---|---|---|---|---|---| | [com.google.cloud.opentelemetry:detector-resources-support](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java) | `0.27.0` -> `0.28.0` | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | [](https://docs.renovatebot.com/merge-confidence/) | --- > [!WARNING] > Some dependencies could not be looked up. Check the Dependency Dashboard for more information. --- ### Release Notes <details> <summary>GoogleCloudPlatform/opentelemetry-operations-java (com.google.cloud.opentelemetry:detector-resources-support)</summary> ### [`v0.28.0`](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/releases/tag/v0.28.0) [Compare Source](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/compare/v0.27.0...v0.28.0) #### Release Highlights - Add support for `CreateServiceTimeseries` in metrics exporter in [#​318](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/issues/318). - Add resource attributes as metrics labels by providing a Predicate based filter to control which resource attributes end up as metric labels in [#​314](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/issues/314), [#​319](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/issues/319). #### What's Changed - Add Readme for detector-resources-support module by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/282](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/282) - Copy instrumentation quickstart out of java-docs-samples by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/283](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/283) - Enable snippet-bot by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/284](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/284) - Quota project fix by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/286](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/286) - Use logstash-logback-encoder version that works with spring boot 2 by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/285](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/285) - Update instrumentation quickstart README links by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/287](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/287) - Make examples/instrumentation-quickstart a standalone gradle build by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/289](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/289) - Add CI for examples/instrumentation-quickstart by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/290](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/290) - Test against java 11 by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/293](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/293) - Update TraceTranslator.java by [@​WadeGulbrandsen](https://togithub.com/WadeGulbrandsen) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/296](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/296) - feat: simplify logging in instrumentation quickstart by [@​dashpole](https://togithub.com/dashpole) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/298](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/298) - Update Gradle to v8.6 by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/300](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/300) - Replace resource detector with upstream detector by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/301](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/301) - Update links to the upstream detector by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/302](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/302) - Add OTLP trace with ADC example by [@​damemi](https://togithub.com/damemi) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/297](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/297) - Update auto-exporter readme by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/304](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/304) - Add tests to verify OTel integration using in-memory exporter by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/306](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/306) - Add GH action step to test shadowJar by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/309](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/309) - Add missing GOOGLE_CLOUD_QUOTA_PROJECT environment variable to compose file by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/311](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/311) - Update instrumentation quickstart to new region tag name by [@​aabmass](https://togithub.com/aabmass) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/312](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/312) - Update instrumentation-quickstart README by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/315](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/315) - Add resource attributes as metric labels by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/314](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/314) - Update resource detection sample by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/317](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/317) - Make setResourceAttributesFilter public by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/319](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/319) - Add support for createServiceTimeSeries by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/318](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/318) - Disable release for gcp-resource-detector by [@​psx95](https://togithub.com/psx95) in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/321](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/321) #### New Contributors - [@​WadeGulbrandsen](https://togithub.com/WadeGulbrandsen) made their first contribution in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/296](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/296) - [@​damemi](https://togithub.com/damemi) made their first contribution in [https://github.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/297](https://togithub.com/GoogleCloudPlatform/opentelemetry-operations-java/pull/297) **Full Changelog**: GoogleCloudPlatform/opentelemetry-operations-java@v0.27.0...v0.28.0 </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate](https://www.mend.io/free-developer-tools/renovate/). View repository job log [here](https://developer.mend.io/github/googleapis/sdk-platform-java). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy4zMDEuNCIsInVwZGF0ZWRJblZlciI6IjM3LjMwMS40IiwidGFyZ2V0QnJhbmNoIjoibWFpbiIsImxhYmVscyI6W119-->
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.
Feature Addition
service.name,service.namespaceandservice.idresource attributes to metric labels.NO_RESOURCE_ATTRIBUTESas the resource filter to theMetricConfigurationobject.DEFAULT_RESOURCE_ATTRIBUTES_FILTER.Note: This is similar to how the Google Cloud Monitoring go exporter works.
Testing
service_nameappears under metric labels on GCP console with the expected value.service_nameappears withunknown_resourcesince the example does not include resource detection.Deprecation
AggregateByLabelMetricTimeSeriesBuilderconstructor in favor of one that also accepts a resource attribute filter in form of a predicate. The existing constructor uses theNO_RESOURCE_ATTRIBUTESto keep it in-line with the existing functionality.fixes #313