@@ -413,6 +413,19 @@ func enabledExemplarsConfig() ExemplarsConfig {
413
413
}
414
414
}
415
415
416
+ func enabledEventsConfig () EventsConfig {
417
+ return EventsConfig {
418
+ Enabled : true ,
419
+ Dimensions : []Dimension {{Name : "exception.type" }},
420
+ }
421
+ }
422
+
423
+ func disabledEventsConfig () EventsConfig {
424
+ return EventsConfig {
425
+ Enabled : false ,
426
+ }
427
+ }
428
+
416
429
func explicitHistogramsConfig () HistogramConfig {
417
430
return HistogramConfig {
418
431
Unit : defaultUnit ,
@@ -586,7 +599,7 @@ func TestConcurrentShutdown(t *testing.T) {
586
599
ticker := mockClock .NewTicker (time .Nanosecond )
587
600
588
601
// Test
589
- p := newConnectorImp (t , new (consumertest.MetricsSink ), nil , explicitHistogramsConfig , disabledExemplarsConfig , cumulative , logger , ticker )
602
+ p := newConnectorImp (t , new (consumertest.MetricsSink ), nil , explicitHistogramsConfig , disabledExemplarsConfig , disabledEventsConfig , cumulative , logger , ticker )
590
603
err := p .Start (ctx , componenttest .NewNopHost ())
591
604
require .NoError (t , err )
592
605
@@ -666,7 +679,7 @@ func TestConsumeMetricsErrors(t *testing.T) {
666
679
}
667
680
mockClock := clock .NewMock (time .Now ())
668
681
ticker := mockClock .NewTicker (time .Nanosecond )
669
- p := newConnectorImp (t , mcon , nil , explicitHistogramsConfig , disabledExemplarsConfig , cumulative , logger , ticker )
682
+ p := newConnectorImp (t , mcon , nil , explicitHistogramsConfig , disabledExemplarsConfig , disabledEventsConfig , cumulative , logger , ticker )
670
683
671
684
ctx := metadata .NewIncomingContext (context .Background (), nil )
672
685
err := p .Start (ctx , componenttest .NewNopHost ())
@@ -828,7 +841,7 @@ func TestConsumeTraces(t *testing.T) {
828
841
mockClock := clock .NewMock (time .Now ())
829
842
ticker := mockClock .NewTicker (time .Nanosecond )
830
843
831
- p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), tc .histogramConfig , tc .exemplarConfig , tc .aggregationTemporality , zaptest .NewLogger (t ), ticker )
844
+ p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), tc .histogramConfig , tc .exemplarConfig , disabledEventsConfig , tc .aggregationTemporality , zaptest .NewLogger (t ), ticker )
832
845
833
846
ctx := metadata .NewIncomingContext (context .Background (), nil )
834
847
err := p .Start (ctx , componenttest .NewNopHost ())
@@ -854,7 +867,7 @@ func TestConsumeTraces(t *testing.T) {
854
867
func TestMetricKeyCache (t * testing.T ) {
855
868
mcon := consumertest .NewNop ()
856
869
857
- p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , cumulative , zaptest .NewLogger (t ), nil )
870
+ p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , disabledEventsConfig , cumulative , zaptest .NewLogger (t ), nil )
858
871
traces := buildSampleTrace ()
859
872
860
873
// Test
@@ -885,7 +898,7 @@ func BenchmarkConnectorConsumeTraces(b *testing.B) {
885
898
// Prepare
886
899
mcon := consumertest .NewNop ()
887
900
888
- conn := newConnectorImp (nil , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , cumulative , zaptest .NewLogger (b ), nil )
901
+ conn := newConnectorImp (nil , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , disabledEventsConfig , cumulative , zaptest .NewLogger (b ), nil )
889
902
890
903
traces := buildSampleTrace ()
891
904
@@ -899,7 +912,7 @@ func BenchmarkConnectorConsumeTraces(b *testing.B) {
899
912
func TestExcludeDimensionsConsumeTraces (t * testing.T ) {
900
913
mcon := consumertest .NewNop ()
901
914
excludeDimensions := []string {"span.kind" , "span.name" , "totallyWrongNameDoesNotAffectAnything" }
902
- p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , cumulative , zaptest .NewLogger (t ), nil , excludeDimensions ... )
915
+ p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , disabledEventsConfig , cumulative , zaptest .NewLogger (t ), nil , excludeDimensions ... )
903
916
traces := buildSampleTrace ()
904
917
905
918
// Test
@@ -948,7 +961,7 @@ func TestExcludeDimensionsConsumeTraces(t *testing.T) {
948
961
949
962
}
950
963
951
- func newConnectorImp (t * testing.T , mcon consumer.Metrics , defaultNullValue * string , histogramConfig func () HistogramConfig , exemplarsConfig func () ExemplarsConfig , temporality string , logger * zap.Logger , ticker * clock.Ticker , excludedDimensions ... string ) * connectorImp {
964
+ func newConnectorImp (t * testing.T , mcon consumer.Metrics , defaultNullValue * string , histogramConfig func () HistogramConfig , exemplarsConfig func () ExemplarsConfig , eventsConfig func () EventsConfig , temporality string , logger * zap.Logger , ticker * clock.Ticker , excludedDimensions ... string ) * connectorImp {
952
965
953
966
cfg := & Config {
954
967
AggregationTemporality : temporality ,
@@ -972,6 +985,7 @@ func newConnectorImp(t *testing.T, mcon consumer.Metrics, defaultNullValue *stri
972
985
// Add a resource attribute to test "process" attributes like IP, host, region, cluster, etc.
973
986
{regionResourceAttrName , nil },
974
987
},
988
+ Events : eventsConfig (),
975
989
}
976
990
c , err := newConnector (logger , cfg , ticker )
977
991
require .NoError (t , err )
@@ -1066,7 +1080,7 @@ func TestConnectorConsumeTracesEvictedCacheKey(t *testing.T) {
1066
1080
ticker := mockClock .NewTicker (time .Nanosecond )
1067
1081
1068
1082
// Note: default dimension key cache size is 2.
1069
- p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , cumulative , zaptest .NewLogger (t ), ticker )
1083
+ p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , disabledExemplarsConfig , disabledEventsConfig , cumulative , zaptest .NewLogger (t ), ticker )
1070
1084
1071
1085
ctx := metadata .NewIncomingContext (context .Background (), nil )
1072
1086
err := p .Start (ctx , componenttest .NewNopHost ())
@@ -1320,7 +1334,7 @@ func TestSpanMetrics_Events(t *testing.T) {
1320
1334
}
1321
1335
func TestExemplarsForSumMetrics (t * testing.T ) {
1322
1336
mcon := consumertest .NewNop ()
1323
- p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , enabledExemplarsConfig , cumulative , zaptest .NewLogger (t ), nil )
1337
+ p := newConnectorImp (t , mcon , stringp ("defaultNullValue" ), explicitHistogramsConfig , enabledExemplarsConfig , enabledEventsConfig , cumulative , zaptest .NewLogger (t ), nil )
1324
1338
traces := buildSampleTrace ()
1325
1339
1326
1340
// Test
0 commit comments