Skip to content

Commit

Permalink
add TestOTLPGRPCMetrics_partialSuccess
Browse files Browse the repository at this point in the history
  • Loading branch information
endorama committed Dec 22, 2023
1 parent e24b398 commit c69456b
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions systemtest/otlp_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -232,6 +232,39 @@ func TestOTLPGRPCMetrics(t *testing.T) {
assert.True(t, gjson.GetBytes(doc.RawSource, "beats_stats.metrics.apm-server.otlp.grpc.metrics.consumer").Exists())
}

func TestOTLPGRPCMetrics_partialSuccess(t *testing.T) {
systemtest.CleanupElasticsearch(t)
srv := apmservertest.NewUnstartedServerTB(t)
srv.Config.Monitoring = newFastMonitoringConfig()
err := srv.Start()
require.NoError(t, err)

ctx, cancel := context.WithCancel(context.Background())
defer cancel()
err = sendOTLPMetrics(t, ctx, srv, func(meter metric.Meter) {
float64Counter, err := meter.Float64Counter("counter")
require.NoError(t, err)
float64Counter.Add(context.Background(), 1)

int64Histogram, err := meter.Int64Histogram("histogram")
require.NoError(t, err)
int64Histogram.Record(context.Background(), 1)
int64Histogram.Record(context.Background(), 123)
int64Histogram.Record(context.Background(), 1024)
int64Histogram.Record(context.Background(), 20000)
}, sdkmetric.NewView(
sdkmetric.Instrument{Name: "*histogram"},
sdkmetric.Stream{
Aggregation: sdkmetric.AggregationBase2ExponentialHistogram{
MaxSize: 5,
MaxScale: -10,
},
},
))

require.ErrorContains(t, err, "OTLP partial success:")
}

func TestOTLPGRPCLogs(t *testing.T) {
systemtest.CleanupElasticsearch(t)
srv := apmservertest.NewServerTB(t)
Expand Down

0 comments on commit c69456b

Please sign in to comment.