public void GetAllExportedViews_ResultIsUnmodifiable()
        {
            IViewManager viewManager = NoopStats.NewNoopViewManager();
            IView        view1       =
                View.Create(
                    ViewName.Create("View 1"), VIEW_DESCRIPTION, MEASURE, AGGREGATION, new List <ITagKey> {
                KEY
            });

            viewManager.RegisterView(view1);
            ISet <IView> exported = viewManager.AllExportedViews;

            IView view2 =
                View.Create(
                    ViewName.Create("View 2"), VIEW_DESCRIPTION, MEASURE, AGGREGATION, new List <ITagKey> {
                KEY
            });

            Assert.Throws <NotSupportedException>(() => exported.Add(view2));
        }
예제 #2
0
        public void GetAllExportedViews_ResultIsUnmodifiable()
        {
            var viewManager = NoopStats.NewNoopViewManager();
            var view1       =
                View.Create(
                    OpenTelemetry.Stats.ViewName.Create("View 1"), ViewDescription, Measure, Aggregation, new List <TagKey> {
                Key
            });

            viewManager.RegisterView(view1);
            var exported = viewManager.AllExportedViews;

            var view2 =
                View.Create(
                    OpenTelemetry.Stats.ViewName.Create("View 2"), ViewDescription, Measure, Aggregation, new List <TagKey> {
                Key
            });

            Assert.Throws <NotSupportedException>(() => exported.Add(view2));
        }
        public void NoopViewManager_GetView_GettingNonExistentViewReturnsNull()
        {
            var viewManager = NoopStats.NewNoopViewManager();

            Assert.Null(viewManager.GetView(ViewName));
        }
        public void NoopViewManager_RegisterView_DisallowNull()
        {
            var viewManager = NoopStats.NewNoopViewManager();

            Assert.Throws <ArgumentNullException>(() => viewManager.RegisterView(null));
        }
예제 #5
0
 public void DefaultValues()
 {
     Assert.Equal(NoopStats.NoopStatsRecorder, Stats.StatsRecorder);
     Assert.Equal(NoopStats.NewNoopViewManager().GetType(), Stats.ViewManager.GetType());
 }
 public void NoopStatsComponent_GetState()
 {
     Assert.Equal(StatsCollectionState.DISABLED, NoopStats.NewNoopStatsComponent().State);
 }
 public void NoopStatsComponent()
 {
     Assert.Same(NoopStats.NoopStatsRecorder, NoopStats.NewNoopStatsComponent().StatsRecorder);
     Assert.Equal(NoopStats.NewNoopViewManager().GetType(), NoopStats.NewNoopStatsComponent().ViewManager.GetType());
 }