Skip to content

Commit

Permalink
Added to config unit test to check for sending_queue
Browse files Browse the repository at this point in the history
  • Loading branch information
codesmon committed Aug 17, 2023
1 parent 71018ab commit f14681d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions exporter/azuremonitorexporter/config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import (
"github.com/stretchr/testify/require"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/confmap/confmaptest"
"go.opentelemetry.io/collector/exporter/exporterhelper"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/azuremonitorexporter/internal/metadata"
)
Expand All @@ -22,6 +23,8 @@ func TestLoadConfig(t *testing.T) {
cm, err := confmaptest.LoadConf(filepath.Join("testdata", "config.yaml"))
require.NoError(t, err)

disk := component.NewIDWithName("disk", "")

tests := []struct {
id component.ID
expected component.Config
Expand All @@ -39,6 +42,12 @@ func TestLoadConfig(t *testing.T) {
MaxBatchSize: 100,
MaxBatchInterval: 10 * time.Second,
SpanEventsEnabled: false,
QueueSettings: exporterhelper.QueueSettings{
QueueSize: 1000,
Enabled: true,
NumConsumers: 10,
StorageID: &disk,
},
},
},
}
Expand Down
2 changes: 2 additions & 0 deletions exporter/azuremonitorexporter/factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/microsoft/ApplicationInsights-Go/appinsights"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/exporter"
"go.opentelemetry.io/collector/exporter/exporterhelper"
"go.uber.org/zap"

"github.com/open-telemetry/opentelemetry-collector-contrib/exporter/azuremonitorexporter/internal/metadata"
Expand Down Expand Up @@ -48,6 +49,7 @@ func createDefaultConfig() component.Config {
MaxBatchSize: 1024,
MaxBatchInterval: 10 * time.Second,
SpanEventsEnabled: false,
QueueSettings: exporterhelper.NewDefaultQueueSettings(),
}
}

Expand Down
9 changes: 9 additions & 0 deletions exporter/azuremonitorexporter/testdata/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,12 @@ azuremonitor/2:
maxbatchsize: 100
# maxbatchinterval is the maximum time to wait before calling the configured endpoint.
maxbatchinterval: 10s

sending_queue:
# queue_size is the maximum number of items that can be queued before dropping data
queue_size: 1000
enabled: true
num_consumers: 10
storage: disk

disk/3:

0 comments on commit f14681d

Please sign in to comment.