-
Notifications
You must be signed in to change notification settings - Fork 2.2k
/
config.go
47 lines (33 loc) · 1.77 KB
/
config.go
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
// Copyright The OpenTelemetry Authors
// SPDX-License-Identifier: Apache-2.0
package prometheusexporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/prometheusexporter"
import (
"time"
"github.com/prometheus/client_golang/prometheus"
"go.opentelemetry.io/collector/component"
"go.opentelemetry.io/collector/config/confighttp"
"github.com/open-telemetry/opentelemetry-collector-contrib/pkg/resourcetotelemetry"
)
// Config defines configuration for Prometheus exporter.
type Config struct {
confighttp.HTTPServerSettings `mapstructure:",squash"`
// Namespace if set, exports metrics under the provided value.
Namespace string `mapstructure:"namespace"`
// ConstLabels are values that are applied for every exported metric.
ConstLabels prometheus.Labels `mapstructure:"const_labels"`
// SendTimestamps will send the underlying scrape timestamp with the export
SendTimestamps bool `mapstructure:"send_timestamps"`
// MetricExpiration defines how long metrics are kept without updates
MetricExpiration time.Duration `mapstructure:"metric_expiration"`
// ResourceToTelemetrySettings defines configuration for converting resource attributes to metric labels.
ResourceToTelemetrySettings resourcetotelemetry.Settings `mapstructure:"resource_to_telemetry_conversion"`
// EnableOpenMetrics enables the use of the OpenMetrics encoding option for the prometheus exporter.
EnableOpenMetrics bool `mapstructure:"enable_open_metrics"`
// AddTypeAndUnitSuffixes controls whether suffixes are added to metric names. Defaults to true.
AddTypeAndUnitSuffixes bool `mapstructure:"add_type_and_unit_suffixes"`
}
var _ component.Config = (*Config)(nil)
// Validate checks if the exporter configuration is valid
func (cfg *Config) Validate() error {
return nil
}