Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added persistent_queue capability to Azure Monitor Exporter #1

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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))
}