Skip to content

Commit 45037ac

Browse files
authored
Fix default Metric view name (#1515)
1 parent ba1cd0d commit 45037ac

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

sdk/include/opentelemetry/sdk/metrics/view/view_registry.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ class ViewRegistry
6464
// return default view if none found;
6565
if (!found)
6666
{
67-
static View view("otel-default-view");
67+
static const View view("");
6868
if (!callback(view))
6969
{
7070
return false;

sdk/test/metrics/view_registry_test.cc

+7-1
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,17 @@ TEST(ViewRegistry, FindViewsEmptyRegistry)
2929
registry.FindViews(default_instrument_descriptor, *default_instrumentation_scope.get(),
3030
[&count](const View &view) {
3131
count++;
32-
EXPECT_EQ(view.GetName(), "otel-default-view");
32+
# if HAVE_WORKING_REGEX
33+
EXPECT_EQ(view.GetName(), "");
3334
EXPECT_EQ(view.GetDescription(), "");
35+
# endif
3436
EXPECT_EQ(view.GetAggregationType(), AggregationType::kDefault);
3537
return true;
3638
});
39+
# if HAVE_WORKING_REGEX
3740
EXPECT_EQ(count, 1);
3841
EXPECT_EQ(status, true);
42+
# endif
3943
}
4044

4145
TEST(ViewRegistry, FindNonExistingView)
@@ -76,7 +80,9 @@ TEST(ViewRegistry, FindNonExistingView)
7680
# endif
7781
return true;
7882
});
83+
# if HAVE_WORKING_REGEX
7984
EXPECT_EQ(count, 1);
8085
EXPECT_EQ(status, true);
86+
# endif
8187
}
8288
#endif

0 commit comments

Comments
 (0)