forked from open-telemetry/opentelemetry-collector
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexporter.go
More file actions
90 lines (75 loc) · 3.1 KB
/
exporter.go
File metadata and controls
90 lines (75 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package component
import (
"context"
"go.uber.org/zap"
"go.opentelemetry.io/collector/config"
"go.opentelemetry.io/collector/consumer"
)
// Exporter exports telemetry data from the collector to a destination.
type Exporter interface {
Component
}
// TracesExporter is an Exporter that can consume traces.
type TracesExporter interface {
Exporter
consumer.Traces
}
// MetricsExporter is an Exporter that can consume metrics.
type MetricsExporter interface {
Exporter
consumer.Metrics
}
// LogsExporter is an Exporter that can consume logs.
type LogsExporter interface {
Exporter
consumer.Logs
}
// ExporterCreateSettings configures Exporter creators.
type ExporterCreateSettings struct {
// Logger that the factory can use during creation and can pass to the created
// component to be used later as well.
Logger *zap.Logger
// BuildInfo can be used by components for informational purposes
BuildInfo BuildInfo
}
// ExporterFactory can create MetricsExporter, TracesExporter and
// LogsExporter. This is the new preferred factory type to create exporters.
type ExporterFactory interface {
Factory
// CreateDefaultConfig creates the default configuration for the Exporter.
// This method can be called multiple times depending on the pipeline
// configuration and should not cause side-effects that prevent the creation
// of multiple instances of the Exporter.
// The object returned by this method needs to pass the checks implemented by
// 'configcheck.ValidateConfig'. It is recommended to have these checks in the
// tests of any implementation of the Factory interface.
CreateDefaultConfig() config.Exporter
// CreateTracesExporter creates a trace exporter based on this config.
// If the exporter type does not support tracing or if the config is not valid,
// an error will be returned instead.
CreateTracesExporter(ctx context.Context, set ExporterCreateSettings,
cfg config.Exporter) (TracesExporter, error)
// CreateMetricsExporter creates a metrics exporter based on this config.
// If the exporter type does not support metrics or if the config is not valid,
// an error will be returned instead.
CreateMetricsExporter(ctx context.Context, set ExporterCreateSettings,
cfg config.Exporter) (MetricsExporter, error)
// CreateLogsExporter creates an exporter based on the config.
// If the exporter type does not support logs or if the config is not valid,
// an error will be returned instead.
CreateLogsExporter(ctx context.Context, set ExporterCreateSettings,
cfg config.Exporter) (LogsExporter, error)
}