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 default Metric view name #1515

Merged
merged 13 commits into from
Aug 10, 2022
Merged

Conversation

esigo
Copy link
Member

@esigo esigo commented Jul 24, 2022

Fixes #1510 (issue)

Changes

when the view is not registered, creates and registers a new view with the provided information.

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

@esigo esigo requested a review from a team July 24, 2022 14:04
@esigo esigo added bug Something isn't working metrics spec-compliance Not compliant to OpenTelemetry specs labels Jul 24, 2022
@codecov
Copy link

codecov bot commented Jul 24, 2022

Codecov Report

Merging #1515 (9e74e43) into main (ba1cd0d) will increase coverage by 0.07%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #1515      +/-   ##
==========================================
+ Coverage   83.85%   83.91%   +0.07%     
==========================================
  Files         156      156              
  Lines        4908     4908              
==========================================
+ Hits         4115     4118       +3     
+ Misses        793      790       -3     
Impacted Files Coverage Δ
...ude/opentelemetry/sdk/metrics/view/view_registry.h 93.75% <100.00%> (ø)
ext/src/http/client/curl/http_client_curl.cc 81.44% <0.00%> (+1.14%) ⬆️

EXPECT_EQ(view.GetAggregationType(), AggregationType::kDefault);
return true;
});
# if HAVE_WORKING_REGEX
Copy link
Member

Choose a reason for hiding this comment

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

Oh, I forgot to create an issue to support this for gcc4.8. Will create one.

{
return false;
}
createView(instrument_descriptor, instrumentation_scope);
Copy link
Member

Choose a reason for hiding this comment

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

Just thinking if we just create a static view with the empty name:

if (!found)
{
  static View view("");
  . . . 
}

And then this part of code -

view_instr_desc.name_ = view.GetName();
- will not overwrite the name in InstrumentDescriptor.

Copy link
Member

Choose a reason for hiding this comment

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

@esigo - pinging just in case these comments got missed :)

Copy link
Member Author

Choose a reason for hiding this comment

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

@lalitb thanks, I use static view now.

@@ -64,7 +64,7 @@ class ViewRegistry
// return default view if none found;
if (!found)
{
static View view("otel-default-view");
static View view("");
Copy link
Contributor

Choose a reason for hiding this comment

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

Could this be declared as static const?

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, yes I changed to const.

@lalitb lalitb merged commit 45037ac into open-telemetry:main Aug 10, 2022
@esigo esigo deleted the Default-Metric-view-name branch August 10, 2022 19:29
yxue pushed a commit to yxue/opentelemetry-cpp that referenced this pull request Dec 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working metrics spec-compliance Not compliant to OpenTelemetry specs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Default Metric view should use instrument name.
3 participants