From 2275a552c29d5c474570cece34b9baab9a69c40c Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Wed, 2 Feb 2022 21:19:13 +0000 Subject: [PATCH 1/3] Add Marshaling implementations for exporters --- exporters/jaeger/jaeger.go | 9 +++++++++ exporters/otlp/otlptrace/exporter.go | 11 +++++++++++ exporters/otlp/otlptrace/otlptracegrpc/client.go | 11 +++++++++++ exporters/otlp/otlptrace/otlptracehttp/client.go | 13 +++++++++++++ exporters/zipkin/zipkin.go | 11 +++++++++++ sdk/trace/simple_span_processor.go | 2 +- 6 files changed, 56 insertions(+), 1 deletion(-) diff --git a/exporters/jaeger/jaeger.go b/exporters/jaeger/jaeger.go index 22a5ed1afa8..d87b79621ef 100644 --- a/exporters/jaeger/jaeger.go +++ b/exporters/jaeger/jaeger.go @@ -123,6 +123,15 @@ func (e *Exporter) Shutdown(ctx context.Context) error { return e.uploader.shutdown(ctx) } +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + }{ + Type: "jaeger", + } +} + func spanToThrift(ss sdktrace.ReadOnlySpan) *gen.Span { attr := ss.Attributes() tags := make([]*gen.Tag, 0, len(attr)) diff --git a/exporters/otlp/otlptrace/exporter.go b/exporters/otlp/otlptrace/exporter.go index 7e9bb6c47ae..c5ee6c098cc 100644 --- a/exporters/otlp/otlptrace/exporter.go +++ b/exporters/otlp/otlptrace/exporter.go @@ -100,3 +100,14 @@ func NewUnstarted(client Client) *Exporter { client: client, } } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + Client Client + }{ + Type: "otlptrace", + Client: e.client, + } +} diff --git a/exporters/otlp/otlptrace/otlptracegrpc/client.go b/exporters/otlp/otlptrace/otlptracegrpc/client.go index d709ffa96e1..31ed8190b67 100644 --- a/exporters/otlp/otlptrace/otlptracegrpc/client.go +++ b/exporters/otlp/otlptrace/otlptracegrpc/client.go @@ -273,3 +273,14 @@ func throttleDelay(status *status.Status) time.Duration { } return 0 } + +// MarshalLog is the marshaling function used by the logging system to represent this Client. +func (c *client) MarshalLog() interface{} { + return struct { + Type string + Endpoint string + }{ + Type: "otlphttpgrpc", + Endpoint: c.endpoint, + } +} diff --git a/exporters/otlp/otlptrace/otlptracehttp/client.go b/exporters/otlp/otlptrace/otlptracehttp/client.go index 81487f9b6f9..a46024f8bc9 100644 --- a/exporters/otlp/otlptrace/otlptracehttp/client.go +++ b/exporters/otlp/otlptrace/otlptracehttp/client.go @@ -243,6 +243,19 @@ func (d *client) newRequest(body []byte) (request, error) { return req, nil } +// MarshalLog is the marshaling function used by the logging system to represent this Client. +func (d *client) MarshalLog() interface{} { + return struct { + Type string + Endpoint string + Insecure bool + }{ + Type: "otlphttphttp", + Endpoint: d.cfg.Endpoint, + Insecure: d.cfg.Insecure, + } +} + // bodyReader returns a closure returning a new reader for buf. func bodyReader(buf []byte) func() io.ReadCloser { return func() io.ReadCloser { diff --git a/exporters/zipkin/zipkin.go b/exporters/zipkin/zipkin.go index 5c7c20049d9..be14ff12879 100644 --- a/exporters/zipkin/zipkin.go +++ b/exporters/zipkin/zipkin.go @@ -180,3 +180,14 @@ func (e *Exporter) errf(format string, args ...interface{}) error { e.logf(format, args...) return fmt.Errorf(format, args...) } + +// MarshalLog is the marshaling function used by the logging system to represent this exporter. +func (e *Exporter) MarshalLog() interface{} { + return struct { + Type string + URL string + }{ + Type: "zipkin", + URL: e.url, + } +} diff --git a/sdk/trace/simple_span_processor.go b/sdk/trace/simple_span_processor.go index d31d3c1caff..e8530a95932 100644 --- a/sdk/trace/simple_span_processor.go +++ b/sdk/trace/simple_span_processor.go @@ -116,7 +116,7 @@ func (ssp *simpleSpanProcessor) ForceFlush(context.Context) error { return nil } -// MarshalLog is the marshaling function used by the logging system to represent this exporter. +// MarshalLog is the marshaling function used by the logging system to represent this Span Processor. func (ssp *simpleSpanProcessor) MarshalLog() interface{} { return struct { Type string From 28e875316fd22853f7ac7140a8c7ea0e7b0c0f6f Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Wed, 2 Feb 2022 21:52:47 +0000 Subject: [PATCH 2/3] Changelog --- CHANGELOG.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fb91daf7486..a4d97072d08 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -12,7 +12,8 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support `OTEL_EXPORTER_ZIPKIN_ENDPOINT` env to specify zipkin collector endpoint (#2490) - Log the configuration of TracerProviders, and Tracers for debugging. To enable use a logger with Verbosity (V level) >=1 -- Added environment variables for: `OTEL_BSP_SCHEDULE_DELAY`, `OTEL_BSP_EXPORT_TIMEOUT`, `OTEL_BSP_MAX_QUEUE_SIZE` and `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` (#2515) +- Log the Exporters configuration in the TracerProviders message. (#2578) +- Added environment variables for: `OTEL_BSP_SCHEDULE_DELAY`, `OTEL_BSP_EXPORT_TIMEOUT`, `OTEL_BSP_MAX_QUEUE_SIZE` and `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` (#2515) ### Changed From c49e6abfa12fb91ca1c5845dfc14194225376e92 Mon Sep 17 00:00:00 2001 From: Aaron Clawson Date: Mon, 7 Feb 2022 20:22:06 +0000 Subject: [PATCH 3/3] Fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 14b1d445c4b..54e57689ef1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,7 +13,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm - Support `OTEL_EXPORTER_ZIPKIN_ENDPOINT` env to specify zipkin collector endpoint (#2490) - Log the configuration of TracerProviders, and Tracers for debugging. To enable use a logger with Verbosity (V level) >=1 - Log the Exporters configuration in the TracerProviders message. (#2578) -- Added environment variables for: `OTEL_BSP_SCHEDULE_DELAY`, `OTEL_BSP_EXPORT_TIMEOUT`, `OTEL_BSP_MAX_QUEUE_SIZE` and `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` (#2515) +- Added environment variables for: `OTEL_BSP_SCHEDULE_DELAY`, `OTEL_BSP_EXPORT_TIMEOUT`, `OTEL_BSP_MAX_QUEUE_SIZE` and `OTEL_BSP_MAX_EXPORT_BATCH_SIZE` (#2515) ### Changed