Skip to content

Commit

Permalink
Fix default Metric view name (#1515)
Browse files Browse the repository at this point in the history
  • Loading branch information
esigo authored Aug 10, 2022
1 parent ba1cd0d commit 45037ac
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sdk/include/opentelemetry/sdk/metrics/view/view_registry.h
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class ViewRegistry
// return default view if none found;
if (!found)
{
static View view("otel-default-view");
static const View view("");
if (!callback(view))
{
return false;
Expand Down
8 changes: 7 additions & 1 deletion sdk/test/metrics/view_registry_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,13 +29,17 @@ TEST(ViewRegistry, FindViewsEmptyRegistry)
registry.FindViews(default_instrument_descriptor, *default_instrumentation_scope.get(),
[&count](const View &view) {
count++;
EXPECT_EQ(view.GetName(), "otel-default-view");
# if HAVE_WORKING_REGEX
EXPECT_EQ(view.GetName(), "");
EXPECT_EQ(view.GetDescription(), "");
# endif
EXPECT_EQ(view.GetAggregationType(), AggregationType::kDefault);
return true;
});
# if HAVE_WORKING_REGEX
EXPECT_EQ(count, 1);
EXPECT_EQ(status, true);
# endif
}

TEST(ViewRegistry, FindNonExistingView)
Expand Down Expand Up @@ -76,7 +80,9 @@ TEST(ViewRegistry, FindNonExistingView)
# endif
return true;
});
# if HAVE_WORKING_REGEX
EXPECT_EQ(count, 1);
EXPECT_EQ(status, true);
# endif
}
#endif

1 comment on commit 45037ac

@github-actions
Copy link

Choose a reason for hiding this comment

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

⚠️ Performance Alert ⚠️

Possible performance regression was detected for benchmark 'OpenTelemetry-cpp sdk Benchmark'.
Benchmark result of this commit is worse than the previous benchmark result exceeding threshold 2.

Benchmark suite Current: 45037ac Previous: ba1cd0d Ratio
BM_AlwaysOnSamplerConstruction 4.29336725850513 ns/iter 1.9205917440473028 ns/iter 2.24

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.