-
Notifications
You must be signed in to change notification settings - Fork 21
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
distro: Add opt-in logs support #3673
base: main
Are you sure you want to change the base?
Conversation
Co-authored-by: Robert Pająk <[email protected]>
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3673 +/- ##
==========================================
- Coverage 79.56% 79.43% -0.13%
==========================================
Files 88 88
Lines 3503 3560 +57
==========================================
+ Hits 2787 2828 +41
- Misses 643 655 +12
- Partials 73 77 +4
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
func newOTLPlogExporter(c *exporterConfig) (log.Exporter, error) { | ||
ctx := context.Background() | ||
|
||
var opts []otlploggrpc.Option |
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.
What about HTTP support?
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 is OK.
It is only needed for our trace and metrics ingest endpoints. We do not have logs ingest (sic!).
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 think that it is worth adding a comment that SPLUNK_REALM
is not supported as our Splunk Observability ingest does not support OTLP.
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.
What about sending logs to a local collector over HTTP?
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 are always sending to collector using gRPC for all signals.
See:
splunk-otel-go/distro/exporter.go
Lines 60 to 92 in 46aa0ab
func newOTLPTracesExporter(_ logr.Logger, c *exporterConfig) (trace.SpanExporter, error) { ctx := context.Background() splunkEndpoint := otlpRealmTracesEndpoint() if splunkEndpoint != "" { // Direct ingest to Splunk Observabilty Cloud using HTTP/protobuf. return otlptracehttp.New(ctx, otlptracehttp.WithEndpoint(splunkEndpoint), otlptracehttp.WithURLPath(otlpRealmTracesEndpointPath), otlptracehttp.WithHeaders(map[string]string{ "X-Sf-Token": c.AccessToken, }), ) } var opts []otlptracegrpc.Option if c.AccessToken != "" { opts = append(opts, otlptracegrpc.WithHeaders(map[string]string{ "X-Sf-Token": c.AccessToken, })) } if c.TLSConfig != nil { tlsCreds := credentials.NewTLS(c.TLSConfig) opts = append(opts, otlptracegrpc.WithTLSCredentials(tlsCreds)) } else if noneEnvVarSet(otelExporterOTLPEndpointKey, otelExporterOTLPTracesEndpointKey, splunkRealmKey) { // Assume that the default endpoint (local collector) is non-TLS. opts = append(opts, otlptracegrpc.WithTLSCredentials(insecure.NewCredentials())) } return otlptracegrpc.New(ctx, opts...) } splunk-otel-go/distro/exporter.go
Lines 205 to 237 in 46aa0ab
func newOTLPMetricsExporter(c *exporterConfig) (metric.Exporter, error) { ctx := context.Background() splunkEndpoint := otlpRealmMetricsEndpoint() if splunkEndpoint != "" { // Direct ingest to Splunk Observabilty Cloud using HTTP/protobuf. return otlpmetrichttp.New(ctx, otlpmetrichttp.WithEndpoint(splunkEndpoint), otlpmetrichttp.WithURLPath(otlpRealmMetricsEndpointPath), otlpmetrichttp.WithHeaders(map[string]string{ "X-Sf-Token": c.AccessToken, }), ) } var opts []otlpmetricgrpc.Option if c.AccessToken != "" { opts = append(opts, otlpmetricgrpc.WithHeaders(map[string]string{ "X-Sf-Token": c.AccessToken, })) } if c.TLSConfig != nil { tlsCreds := credentials.NewTLS(c.TLSConfig) opts = append(opts, otlpmetricgrpc.WithTLSCredentials(tlsCreds)) } else if noneEnvVarSet(otelExporterOTLPEndpointKey, otelExporterOTLPMetricsEndpointKey, splunkRealmKey) { // Assume that the default endpoint (local collector) is non-TLS. opts = append(opts, otlpmetricgrpc.WithTLSCredentials(insecure.NewCredentials())) } return otlpmetricgrpc.New(ctx, opts...) }
There was never an ask to add support for OTEL_EXPORTER_OTLP_PROTOCOL
.
Maybe we can consider reusing autoexport
module as a separate PR. What do you think?
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'm confused. Why do we support HTTP for the other signals?
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.
// Direct ingest to Splunk Observabilty Cloud using HTTP/protobuf.
Because back in the days ingest was not supporting gRPC.
Even if we do support gRPC as well I heard that it is better to use http/protobuf
with our backend. This is why AFAIK all our distros are using http/protobuf
when SPLUNK_REALM
is used. We use grpc
in other cases for backwards compatibility.
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.
Even if we do support gRPC as well I heard that it is better to use
http/protobuf
with our backend. This is why AFAIK all our distros are usinghttp/protobuf
whenSPLUNK_REALM
is used. We usegrpc
in other cases for backwards compatibility.
Right ... so shouldn't we support HTTP? This is only adding gRPC exporters but you are saying that HTTP is preferred, right?
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.
Right ... so shouldn't we support HTTP? This is only adding gRPC exporters but you are saying that HTTP is preferred, right?
Ship has sailed.
It would break users that use OTEL_EXPORTER_OTLP_ENDPOINT
which targets gRPC endpoints.
Back in the days we required to default to grpc
in the GDI spec...
Why
Fixes #3514
What
Add opt-in logs support. The user has to set
OTEL_LOGS_EXPORTER
env var tootlp
to enable the OTLP gRPC logs exporter (default isnone
).In a separate PR I will expand
example
with logging support.