-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Verify and update OTLP trace exporter documentation #2053
Conversation
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice progress 👍
exporters/otlp/otlptrace/README.md
Outdated
## [`otlptrace`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace) | ||
|
||
The `otlptrace` package provides an exporter implementing the OTel span exporter interface. | ||
This exporter is configured using a client satisfying the `otlptrace.Client` interface. | ||
This client handles the transformation of data into wire format and the transmission of that data to the collector. | ||
|
||
## [`otlptracegrpc`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracegrpc) | ||
|
||
The `otlptracegrpc` package implements a gRPC client to be used in the span exporter. | ||
|
||
## [`otlptracehttp`](https://pkg.go.dev/go.opentelemetry.io/otel/exporters/otlp/otlptrace/otlptracehttp) | ||
|
||
The `otlptracehttp` package implements a HTTP client to be used in the span exporter. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We miss information about configuration via environmental variables. I am not sure which are supported (you would need to check the code/godoc/changelog). Here are the docs for the env vars that in theory should be supported: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/exporter.md.
Here is a README how the env vars are documented for Jaeger exporter: https://github.com/open-telemetry/opentelemetry-go/blob/main/exporters/jaeger/README.md#environment-variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I hope this will help you;
opentelemetry-go/exporters/otlp/otlptrace/internal/otlpconfig/envconfig.go
Lines 70 to 137 in d5d4c87
func (e *EnvOptionsReader) GetOptionsFromEnv() []GenericOption { | |
var opts []GenericOption | |
// Endpoint | |
if v, ok := e.getEnvValue("ENDPOINT"); ok { | |
if isInsecureEndpoint(v) { | |
opts = append(opts, WithInsecure()) | |
} else { | |
opts = append(opts, WithSecure()) | |
} | |
opts = append(opts, WithEndpoint(trimSchema(v))) | |
} | |
if v, ok := e.getEnvValue("TRACES_ENDPOINT"); ok { | |
if isInsecureEndpoint(v) { | |
opts = append(opts, WithInsecure()) | |
} else { | |
opts = append(opts, WithSecure()) | |
} | |
opts = append(opts, WithEndpoint(trimSchema(v))) | |
} | |
// Certificate File | |
if path, ok := e.getEnvValue("CERTIFICATE"); ok { | |
if tls, err := e.readTLSConfig(path); err == nil { | |
opts = append(opts, WithTLSClientConfig(tls)) | |
} else { | |
otel.Handle(fmt.Errorf("failed to configure otlp exporter certificate '%s': %w", path, err)) | |
} | |
} | |
if path, ok := e.getEnvValue("TRACES_CERTIFICATE"); ok { | |
if tls, err := e.readTLSConfig(path); err == nil { | |
opts = append(opts, WithTLSClientConfig(tls)) | |
} else { | |
otel.Handle(fmt.Errorf("failed to configure otlp traces exporter certificate '%s': %w", path, err)) | |
} | |
} | |
// Headers | |
if h, ok := e.getEnvValue("HEADERS"); ok { | |
opts = append(opts, WithHeaders(stringToHeader(h))) | |
} | |
if h, ok := e.getEnvValue("TRACES_HEADERS"); ok { | |
opts = append(opts, WithHeaders(stringToHeader(h))) | |
} | |
// Compression | |
if c, ok := e.getEnvValue("COMPRESSION"); ok { | |
opts = append(opts, WithCompression(stringToCompression(c))) | |
} | |
if c, ok := e.getEnvValue("TRACES_COMPRESSION"); ok { | |
opts = append(opts, WithCompression(stringToCompression(c))) | |
} | |
// Timeout | |
if t, ok := e.getEnvValue("TIMEOUT"); ok { | |
if d, err := strconv.Atoi(t); err == nil { | |
opts = append(opts, WithTimeout(time.Duration(d)*time.Millisecond)) | |
} | |
} | |
if t, ok := e.getEnvValue("TRACES_TIMEOUT"); ok { | |
if d, err := strconv.Atoi(t); err == nil { | |
opts = append(opts, WithTimeout(time.Duration(d)*time.Millisecond)) | |
} | |
} | |
return opts | |
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pellared can you add this in a follow on PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrAlias Added to my TODO list. I will try to do it next week.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@MrAlias Added to my TODO list. I will try to do it next week.
🎉 thanks 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR: #2222
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
Co-authored-by: Robert Pająk <pellared@hotmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like an incremental improvement to the docs. Thanks for the contribution.
The suggestions are not blocking.
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
Co-authored-by: Tyler Yahn <MrAlias@users.noreply.github.com>
This comment has been minimized.
This comment has been minimized.
This is the last PR blocking our next RC release. I'm going to see if I can push some code to move this along. |
Partially resolved issue #2016 .
I referred to changes related to OTLP trace exporter in #1827,#1832,#1922, #1963,#1985,#1991, #2013 and created a README about the changes.
BecauseI am a freshman in opentelemetry-go, maybe my PR is not good enough.
If you think I can improve in any aspect, please bring it up.
I am very willing to listen to your suggestions.
Thank u~
I will continue to inventory the documentation for OTLP metric exporter.