123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475 |
- // Copyright The OpenTelemetry Authors
- // SPDX-License-Identifier: Apache-2.0
- //go:generate mdatagen metadata.yaml
- package sumologicexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter"
- import (
- "context"
- "fmt"
- "go.opentelemetry.io/collector/component"
- "go.opentelemetry.io/collector/exporter"
- "go.opentelemetry.io/collector/exporter/exporterhelper"
- "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/sumologicexporter/internal/metadata"
- )
- // NewFactory returns a new factory for the sumologic exporter.
- func NewFactory() exporter.Factory {
- return exporter.NewFactory(
- metadata.Type,
- createDefaultConfig,
- exporter.WithLogs(createLogsExporter, metadata.LogsStability),
- exporter.WithMetrics(createMetricsExporter, metadata.MetricsStability),
- )
- }
- func createDefaultConfig() component.Config {
- qs := exporterhelper.NewDefaultQueueSettings()
- qs.Enabled = false
- return &Config{
- CompressEncoding: DefaultCompressEncoding,
- MaxRequestBodySize: DefaultMaxRequestBodySize,
- LogFormat: DefaultLogFormat,
- MetricFormat: DefaultMetricFormat,
- SourceCategory: DefaultSourceCategory,
- SourceName: DefaultSourceName,
- SourceHost: DefaultSourceHost,
- Client: DefaultClient,
- GraphiteTemplate: DefaultGraphiteTemplate,
- HTTPClientSettings: createDefaultHTTPClientSettings(),
- RetrySettings: exporterhelper.NewDefaultRetrySettings(),
- QueueSettings: qs,
- }
- }
- func createLogsExporter(
- _ context.Context,
- params exporter.CreateSettings,
- cfg component.Config,
- ) (exporter.Logs, error) {
- exp, err := newLogsExporter(cfg.(*Config), params)
- if err != nil {
- return nil, fmt.Errorf("failed to create the logs exporter: %w", err)
- }
- return exp, nil
- }
- func createMetricsExporter(
- _ context.Context,
- params exporter.CreateSettings,
- cfg component.Config,
- ) (exporter.Metrics, error) {
- exp, err := newMetricsExporter(cfg.(*Config), params)
- if err != nil {
- return nil, fmt.Errorf("failed to create the metrics exporter: %w", err)
- }
- return exp, nil
- }
|