2021-06-11 22:25:56 +02:00
|
|
|
// 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.
|
|
|
|
|
2021-09-28 04:37:26 +02:00
|
|
|
package otlpmetric // import "go.opentelemetry.io/otel/exporters/otlp/otlpmetric"
|
2021-06-11 22:25:56 +02:00
|
|
|
|
2021-12-13 22:13:03 +02:00
|
|
|
import "go.opentelemetry.io/otel/sdk/metric/export/aggregation"
|
2021-06-11 22:25:56 +02:00
|
|
|
|
|
|
|
// Option are setting options passed to an Exporter on creation.
|
|
|
|
type Option interface {
|
2022-02-01 23:51:23 +02:00
|
|
|
apply(config) config
|
2021-06-11 22:25:56 +02:00
|
|
|
}
|
|
|
|
|
2022-02-01 23:51:23 +02:00
|
|
|
type exporterOptionFunc func(config) config
|
2021-06-11 22:25:56 +02:00
|
|
|
|
2022-02-01 23:51:23 +02:00
|
|
|
func (fn exporterOptionFunc) apply(cfg config) config {
|
|
|
|
return fn(cfg)
|
2021-06-11 22:25:56 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
type config struct {
|
2021-10-15 20:18:36 +02:00
|
|
|
temporalitySelector aggregation.TemporalitySelector
|
2021-06-11 22:25:56 +02:00
|
|
|
}
|
|
|
|
|
2021-10-15 20:18:36 +02:00
|
|
|
// WithMetricAggregationTemporalitySelector defines the aggregation.TemporalitySelector used
|
|
|
|
// for selecting aggregation.Temporality (i.e., Cumulative vs. Delta
|
2021-06-11 22:25:56 +02:00
|
|
|
// aggregation). If not specified otherwise, exporter will use a
|
2021-10-15 20:18:36 +02:00
|
|
|
// cumulative temporality selector.
|
|
|
|
func WithMetricAggregationTemporalitySelector(selector aggregation.TemporalitySelector) Option {
|
2022-02-01 23:51:23 +02:00
|
|
|
return exporterOptionFunc(func(cfg config) config {
|
2021-10-15 20:18:36 +02:00
|
|
|
cfg.temporalitySelector = selector
|
2022-02-01 23:51:23 +02:00
|
|
|
return cfg
|
2021-06-11 22:25:56 +02:00
|
|
|
})
|
|
|
|
}
|