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

impl(otel): copy service resource labels into metric labels #14825

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

IcySteam
Copy link

@IcySteam IcySteam commented Nov 6, 2024

fixed #14823


This change is Reviewable

@IcySteam IcySteam requested a review from a team as a code owner November 6, 2024 03:09
@IcySteam IcySteam marked this pull request as draft November 12, 2024 04:14
Copy link
Member

@dbolduc dbolduc left a comment

Choose a reason for hiding this comment

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

I don't think the copying is necessary. Can we check for the known service labels and do the manipulations here:

for (auto& label : mr.labels) {
(*resource.mutable_labels())[std::move(label.first)] =
std::move(label.second);
}

and add a TEST(ToMonitoredResource, AddsServiceLabels) { ... } in time_series_test.cc ?

scope_metrics.metric_data_) {
for (opentelemetry::sdk::metrics::PointDataAttributes& pda :
metric.point_data_attr_) {
auto& attributes = pda.attributes;
Copy link
Member

Choose a reason for hiding this comment

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

Sorry, I am confused. Do we want the labels to end up getting added to the google.api.Metric https://github.com/googleapis/googleapis/blob/2d05911be5a468b556236bee537c91922f9c23a3/google/api/metric.proto#L286

... or to the google.api.MonitoredResource https://github.com/googleapis/googleapis/blob/2d05911be5a468b556236bee537c91922f9c23a3/google/api/monitored_resource.proto#L106

... or both?

unit tests would help clarify the intended behavior that we want.

@dbolduc
Copy link
Member

dbolduc commented Nov 22, 2024

/gcbrun

Copy link

codecov bot commented Nov 22, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.06%. Comparing base (aa062cf) to head (1775a3e).
Report is 27 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #14825   +/-   ##
=======================================
  Coverage   93.06%   93.06%           
=======================================
  Files        2319     2319           
  Lines      209023   209023           
=======================================
+ Hits       194529   194530    +1     
+ Misses      14494    14493    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.


🚨 Try these New Features:

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.

OTel "service.*" resource labels are not exported to Google Cloud Monitoring
2 participants