You've already forked opentelemetry-go
							
							
				mirror of
				https://github.com/open-telemetry/opentelemetry-go.git
				synced 2025-10-31 00:07:40 +02:00 
			
		
		
		
	Add Marshaling implementations for exporters (#2578)
* Add Marshaling implementations for exporters * Changelog * Fix changelog Co-authored-by: Aaron Clawson <MadVikingGod@users.noreply.github.com> Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This commit is contained in:
		| @@ -18,6 +18,7 @@ This project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.htm | ||||
|    | ||||
|   If the provided environment variables are invalid (negative), the default values would be used. | ||||
| - Rename the `gc` runtime name to `go` (#2560) | ||||
| - Log the Exporters configuration in the TracerProviders message. (#2578) | ||||
|  | ||||
| ### Changed | ||||
|  | ||||
|   | ||||
| @@ -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)) | ||||
|   | ||||
| @@ -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, | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -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, | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -222,6 +222,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 { | ||||
|   | ||||
| @@ -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, | ||||
| 	} | ||||
| } | ||||
|   | ||||
| @@ -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 | ||||
|   | ||||
		Reference in New Issue
	
	Block a user