1// Copyright The OpenTelemetry Authors 2// 3// Licensed under the Apache License, Version 2.0 (the "License"); 4// you may not use this file except in compliance with the License. 5// You may obtain a copy of the License at 6// 7// http://www.apache.org/licenses/LICENSE-2.0 8// 9// Unless required by applicable law or agreed to in writing, software 10// distributed under the License is distributed on an "AS IS" BASIS, 11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12// See the License for the specific language governing permissions and 13// limitations under the License. 14 15package basic // import "go.opentelemetry.io/otel/sdk/metric/processor/basic" 16 17// Config contains the options for configuring a basic metric processor. 18type Config struct { 19 // Memory controls whether the processor remembers metric 20 // instruments and label sets that were previously reported. 21 // When Memory is true, CheckpointSet.ForEach() will visit 22 // metrics that were not updated in the most recent interval. 23 Memory bool 24} 25 26type Option interface { 27 ApplyProcessor(*Config) 28} 29 30// WithMemory sets the memory behavior of a Processor. If this is 31// true, the processor will report metric instruments and label sets 32// that were previously reported but not updated in the most recent 33// interval. 34func WithMemory(memory bool) Option { 35 return memoryOption(memory) 36} 37 38type memoryOption bool 39 40func (m memoryOption) ApplyProcessor(config *Config) { 41 config.Memory = bool(m) 42} 43