Skip to content

Commit

Permalink
Added persistent_queue capability to Azure Monitor Exporter
Browse files Browse the repository at this point in the history
  • Loading branch information
codesmon committed Aug 17, 2023
1 parent 919e970 commit 71018ab
Show file tree
Hide file tree
Showing 5 changed files with 31 additions and 8 deletions.
5 changes: 5 additions & 0 deletions exporter/azuremonitorexporter/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ The following settings can be optionally configured:
- `maxbatchsize` (default = 1024): The maximum number of telemetry items that can be submitted in each request. If this many items are buffered, the buffer will be flushed before `maxbatchinterval` expires.
- `maxbatchinterval` (default = 10s): The maximum time to wait before sending a batch of telemetry.
- `spaneventsenabled` (default = false): Enables export of span events.
- `sending_queue`
- `enabled` (default = false)
- `num_consumers` (default = 10): Number of consumers that dequeue batches; ignored if `enabled` is `false`
- `queue_size` (default = 1000): Maximum number of batches kept in memory before data; ignored if `enabled` is `false`
- `storage` (default = `none`): When set, enables persistence and uses the component specified as a storage extension for the persistent queue

Example:

Expand Down
12 changes: 7 additions & 5 deletions exporter/azuremonitorexporter/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,15 @@ import (
"time"

"go.opentelemetry.io/collector/config/configopaque"
"go.opentelemetry.io/collector/exporter/exporterhelper"
)

// Config defines configuration for Azure Monitor
type Config struct {
Endpoint string `mapstructure:"endpoint"`
InstrumentationKey configopaque.String `mapstructure:"instrumentation_key"`
MaxBatchSize int `mapstructure:"maxbatchsize"`
MaxBatchInterval time.Duration `mapstructure:"maxbatchinterval"`
SpanEventsEnabled bool `mapstructure:"spaneventsenabled"`
exporterhelper.QueueSettings `mapstructure:"sending_queue"`
Endpoint string `mapstructure:"endpoint"`
InstrumentationKey configopaque.String `mapstructure:"instrumentation_key"`
MaxBatchSize int `mapstructure:"maxbatchsize"`
MaxBatchInterval time.Duration `mapstructure:"maxbatchinterval"`
SpanEventsEnabled bool `mapstructure:"spaneventsenabled"`
}
8 changes: 7 additions & 1 deletion exporter/azuremonitorexporter/logexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,11 @@ func newLogsExporter(config *Config, transportChannel transportChannel, set expo
logger: set.Logger,
}

return exporterhelper.NewLogsExporter(context.TODO(), set, config, exporter.onLogData)
return exporterhelper.NewLogsExporter(
context.TODO(),
set,
config,
exporter.onLogData,
exporterhelper.WithQueue(config.QueueSettings),
)
}
7 changes: 6 additions & 1 deletion exporter/azuremonitorexporter/metricexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,5 +49,10 @@ func newMetricsExporter(config *Config, transportChannel transportChannel, set e
packer: newMetricPacker(set.Logger),
}

return exporterhelper.NewMetricsExporter(context.TODO(), set, config, exporter.onMetricData)
return exporterhelper.NewMetricsExporter(
context.TODO(),
set,
config,
exporter.onMetricData,
exporterhelper.WithQueue(config.QueueSettings))
}
7 changes: 6 additions & 1 deletion exporter/azuremonitorexporter/traceexporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,5 +70,10 @@ func newTracesExporter(config *Config, transportChannel transportChannel, set ex
logger: set.Logger,
}

return exporterhelper.NewTracesExporter(context.TODO(), set, config, exporter.onTraceData)
return exporterhelper.NewTracesExporter(
context.TODO(),
set,
config,
exporter.onTraceData,
exporterhelper.WithQueue(config.QueueSettings))
}

0 comments on commit 71018ab

Please sign in to comment.