chore: upgrade dependencies
This commit is contained in:
		
							
								
								
									
										48
									
								
								vendor/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										48
									
								
								vendor/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/config.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -22,10 +22,10 @@ import (
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	defaultWriter       = os.Stdout
 | 
			
		||||
	defaultPrettyPrint  = false
 | 
			
		||||
	defaultTimestamps   = true
 | 
			
		||||
	defaultLabelEncoder = attribute.DefaultEncoder()
 | 
			
		||||
	defaultWriter      = os.Stdout
 | 
			
		||||
	defaultPrettyPrint = false
 | 
			
		||||
	defaultTimestamps  = true
 | 
			
		||||
	defaultAttrEncoder = attribute.DefaultEncoder()
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// config contains options for the STDOUT exporter.
 | 
			
		||||
@@ -41,20 +41,20 @@ type config struct {
 | 
			
		||||
	// true.
 | 
			
		||||
	Timestamps bool
 | 
			
		||||
 | 
			
		||||
	// LabelEncoder encodes the labels.
 | 
			
		||||
	LabelEncoder attribute.Encoder
 | 
			
		||||
	// Encoder encodes the attributes.
 | 
			
		||||
	Encoder attribute.Encoder
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// newConfig creates a validated Config configured with options.
 | 
			
		||||
func newConfig(options ...Option) (config, error) {
 | 
			
		||||
	cfg := config{
 | 
			
		||||
		Writer:       defaultWriter,
 | 
			
		||||
		PrettyPrint:  defaultPrettyPrint,
 | 
			
		||||
		Timestamps:   defaultTimestamps,
 | 
			
		||||
		LabelEncoder: defaultLabelEncoder,
 | 
			
		||||
		Writer:      defaultWriter,
 | 
			
		||||
		PrettyPrint: defaultPrettyPrint,
 | 
			
		||||
		Timestamps:  defaultTimestamps,
 | 
			
		||||
		Encoder:     defaultAttrEncoder,
 | 
			
		||||
	}
 | 
			
		||||
	for _, opt := range options {
 | 
			
		||||
		opt.apply(&cfg)
 | 
			
		||||
		cfg = opt.apply(cfg)
 | 
			
		||||
 | 
			
		||||
	}
 | 
			
		||||
	return cfg, nil
 | 
			
		||||
@@ -62,7 +62,7 @@ func newConfig(options ...Option) (config, error) {
 | 
			
		||||
 | 
			
		||||
// Option sets the value of an option for a Config.
 | 
			
		||||
type Option interface {
 | 
			
		||||
	apply(*config)
 | 
			
		||||
	apply(config) config
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WithWriter sets the export stream destination.
 | 
			
		||||
@@ -74,8 +74,9 @@ type writerOption struct {
 | 
			
		||||
	W io.Writer
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o writerOption) apply(cfg *config) {
 | 
			
		||||
func (o writerOption) apply(cfg config) config {
 | 
			
		||||
	cfg.Writer = o.W
 | 
			
		||||
	return cfg
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WithPrettyPrint sets the export stream format to use JSON.
 | 
			
		||||
@@ -85,8 +86,9 @@ func WithPrettyPrint() Option {
 | 
			
		||||
 | 
			
		||||
type prettyPrintOption bool
 | 
			
		||||
 | 
			
		||||
func (o prettyPrintOption) apply(cfg *config) {
 | 
			
		||||
func (o prettyPrintOption) apply(cfg config) config {
 | 
			
		||||
	cfg.PrettyPrint = bool(o)
 | 
			
		||||
	return cfg
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WithoutTimestamps sets the export stream to not include timestamps.
 | 
			
		||||
@@ -96,19 +98,21 @@ func WithoutTimestamps() Option {
 | 
			
		||||
 | 
			
		||||
type timestampsOption bool
 | 
			
		||||
 | 
			
		||||
func (o timestampsOption) apply(cfg *config) {
 | 
			
		||||
func (o timestampsOption) apply(cfg config) config {
 | 
			
		||||
	cfg.Timestamps = bool(o)
 | 
			
		||||
	return cfg
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// WithLabelEncoder sets the label encoder used in export.
 | 
			
		||||
func WithLabelEncoder(enc attribute.Encoder) Option {
 | 
			
		||||
	return labelEncoderOption{enc}
 | 
			
		||||
// WithAttributeEncoder sets the attribute encoder used in export.
 | 
			
		||||
func WithAttributeEncoder(enc attribute.Encoder) Option {
 | 
			
		||||
	return attrEncoderOption{enc}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type labelEncoderOption struct {
 | 
			
		||||
	LabelEncoder attribute.Encoder
 | 
			
		||||
type attrEncoderOption struct {
 | 
			
		||||
	encoder attribute.Encoder
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (o labelEncoderOption) apply(cfg *config) {
 | 
			
		||||
	cfg.LabelEncoder = o.LabelEncoder
 | 
			
		||||
func (o attrEncoderOption) apply(cfg config) config {
 | 
			
		||||
	cfg.Encoder = o.encoder
 | 
			
		||||
	return cfg
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										6
									
								
								vendor/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/exporter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/exporter.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -14,16 +14,14 @@
 | 
			
		||||
 | 
			
		||||
package stdoutmetric // import "go.opentelemetry.io/otel/exporters/stdout/stdoutmetric"
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/export/metric"
 | 
			
		||||
)
 | 
			
		||||
import "go.opentelemetry.io/otel/sdk/metric/export"
 | 
			
		||||
 | 
			
		||||
type Exporter struct {
 | 
			
		||||
	metricExporter
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var (
 | 
			
		||||
	_ metric.Exporter = &Exporter{}
 | 
			
		||||
	_ export.Exporter = &Exporter{}
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
// New creates an Exporter with the passed options.
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										44
									
								
								vendor/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/metric.go
									
									
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										44
									
								
								vendor/go.opentelemetry.io/otel/exporters/stdout/stdoutmetric/metric.go
									
									
									
										generated
									
									
										vendored
									
									
								
							@@ -22,10 +22,10 @@ import (
 | 
			
		||||
	"time"
 | 
			
		||||
 | 
			
		||||
	"go.opentelemetry.io/otel/attribute"
 | 
			
		||||
	"go.opentelemetry.io/otel/metric/sdkapi"
 | 
			
		||||
	exportmetric "go.opentelemetry.io/otel/sdk/export/metric"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/export/metric/aggregation"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/instrumentation"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/metric/export"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/metric/export/aggregation"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/metric/sdkapi"
 | 
			
		||||
	"go.opentelemetry.io/otel/sdk/resource"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
@@ -33,7 +33,7 @@ type metricExporter struct {
 | 
			
		||||
	config config
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
var _ exportmetric.Exporter = &metricExporter{}
 | 
			
		||||
var _ export.Exporter = &metricExporter{}
 | 
			
		||||
 | 
			
		||||
type line struct {
 | 
			
		||||
	Name      string      `json:"Name"`
 | 
			
		||||
@@ -49,29 +49,29 @@ func (e *metricExporter) TemporalityFor(desc *sdkapi.Descriptor, kind aggregatio
 | 
			
		||||
	return aggregation.StatelessTemporalitySelector().TemporalityFor(desc, kind)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reader exportmetric.InstrumentationLibraryReader) error {
 | 
			
		||||
func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reader export.InstrumentationLibraryReader) error {
 | 
			
		||||
	var aggError error
 | 
			
		||||
	var batch []line
 | 
			
		||||
	aggError = reader.ForEach(func(lib instrumentation.Library, mr exportmetric.Reader) error {
 | 
			
		||||
	aggError = reader.ForEach(func(lib instrumentation.Library, mr export.Reader) error {
 | 
			
		||||
 | 
			
		||||
		var instLabels []attribute.KeyValue
 | 
			
		||||
		var instAttrs []attribute.KeyValue
 | 
			
		||||
		if name := lib.Name; name != "" {
 | 
			
		||||
			instLabels = append(instLabels, attribute.String("instrumentation.name", name))
 | 
			
		||||
			instAttrs = append(instAttrs, attribute.String("instrumentation.name", name))
 | 
			
		||||
			if version := lib.Version; version != "" {
 | 
			
		||||
				instLabels = append(instLabels, attribute.String("instrumentation.version", version))
 | 
			
		||||
				instAttrs = append(instAttrs, attribute.String("instrumentation.version", version))
 | 
			
		||||
			}
 | 
			
		||||
			if schema := lib.SchemaURL; schema != "" {
 | 
			
		||||
				instLabels = append(instLabels, attribute.String("instrumentation.schema_url", schema))
 | 
			
		||||
				instAttrs = append(instAttrs, attribute.String("instrumentation.schema_url", schema))
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		instSet := attribute.NewSet(instLabels...)
 | 
			
		||||
		encodedInstLabels := instSet.Encoded(e.config.LabelEncoder)
 | 
			
		||||
		instSet := attribute.NewSet(instAttrs...)
 | 
			
		||||
		encodedInstAttrs := instSet.Encoded(e.config.Encoder)
 | 
			
		||||
 | 
			
		||||
		return mr.ForEach(e, func(record exportmetric.Record) error {
 | 
			
		||||
		return mr.ForEach(e, func(record export.Record) error {
 | 
			
		||||
			desc := record.Descriptor()
 | 
			
		||||
			agg := record.Aggregation()
 | 
			
		||||
			kind := desc.NumberKind()
 | 
			
		||||
			encodedResource := res.Encoded(e.config.LabelEncoder)
 | 
			
		||||
			encodedResource := res.Encoded(e.config.Encoder)
 | 
			
		||||
 | 
			
		||||
			var expose line
 | 
			
		||||
 | 
			
		||||
@@ -93,27 +93,27 @@ func (e *metricExporter) Export(_ context.Context, res *resource.Resource, reade
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			var encodedLabels string
 | 
			
		||||
			iter := record.Labels().Iter()
 | 
			
		||||
			var encodedAttrs string
 | 
			
		||||
			iter := record.Attributes().Iter()
 | 
			
		||||
			if iter.Len() > 0 {
 | 
			
		||||
				encodedLabels = record.Labels().Encoded(e.config.LabelEncoder)
 | 
			
		||||
				encodedAttrs = record.Attributes().Encoded(e.config.Encoder)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			var sb strings.Builder
 | 
			
		||||
 | 
			
		||||
			sb.WriteString(desc.Name())
 | 
			
		||||
 | 
			
		||||
			if len(encodedLabels) > 0 || len(encodedResource) > 0 || len(encodedInstLabels) > 0 {
 | 
			
		||||
			if len(encodedAttrs) > 0 || len(encodedResource) > 0 || len(encodedInstAttrs) > 0 {
 | 
			
		||||
				sb.WriteRune('{')
 | 
			
		||||
				sb.WriteString(encodedResource)
 | 
			
		||||
				if len(encodedInstLabels) > 0 && len(encodedResource) > 0 {
 | 
			
		||||
				if len(encodedInstAttrs) > 0 && len(encodedResource) > 0 {
 | 
			
		||||
					sb.WriteRune(',')
 | 
			
		||||
				}
 | 
			
		||||
				sb.WriteString(encodedInstLabels)
 | 
			
		||||
				if len(encodedLabels) > 0 && (len(encodedInstLabels) > 0 || len(encodedResource) > 0) {
 | 
			
		||||
				sb.WriteString(encodedInstAttrs)
 | 
			
		||||
				if len(encodedAttrs) > 0 && (len(encodedInstAttrs) > 0 || len(encodedResource) > 0) {
 | 
			
		||||
					sb.WriteRune(',')
 | 
			
		||||
				}
 | 
			
		||||
				sb.WriteString(encodedLabels)
 | 
			
		||||
				sb.WriteString(encodedAttrs)
 | 
			
		||||
				sb.WriteRune('}')
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user