Skip to content
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

otlpHTTPLogExporter, otlpGRPCLogExporter, etc do not support fields like OTLP.Certificate #6351

Open
mattsains opened this issue Nov 19, 2024 · 4 comments
Labels
area: config Related to config functionality bug Something isn't working

Comments

@mattsains
Copy link

mattsains commented Nov 19, 2024

Description

The OTLP configuration type has fields Certificate, ClientCertificate, ClientKey, HeadersList and Insecure:

Certificate *string `json:"certificate,omitempty" yaml:"certificate,omitempty" mapstructure:"certificate,omitempty"`
// ClientCertificate corresponds to the JSON schema field "client_certificate".
ClientCertificate *string `json:"client_certificate,omitempty" yaml:"client_certificate,omitempty" mapstructure:"client_certificate,omitempty"`
// ClientKey corresponds to the JSON schema field "client_key".
ClientKey *string `json:"client_key,omitempty" yaml:"client_key,omitempty" mapstructure:"client_key,omitempty"`

These fields are not read/supported by constructors like otlpGRPCLogExporter, otlpHTTPLogExporter, otlpHTTPMetricExporter, otlpGRPCMetricExporter, otlpGRPCSpanExporter and otlpHTTPSpanExporter.

Environment

  • OS: N/A
  • Architecture: N/A
  • Go Version: N/A
  • config version: 6e79f7c, 1.32.0

Steps To Reproduce

An example of how to trigger this is to call NewSDK specifying a custom certificate. This certificate will not be used when connecting to the trace endpoint specified.

Expected behavior

These fields should be respected when creating log, trace and metric exporters.

@mattsains mattsains added area: config Related to config functionality bug Something isn't working labels Nov 19, 2024
@mattsains
Copy link
Author

I think that this code is used in the collector's internal telemetry exporting too: https://github.com/open-telemetry/opentelemetry-collector/blob/9d2685f404ef65b46152ae80c36ff84f303e3cc6/service/service.go#L133C5-L138C7

I believe the fix for this is as simple as something like this case for Certificate:

if otlpConfig.Certificate != nil {
	creds, err := credentials.NewClientTLSFromFile(*otlpConfig.Certificate, "")
	opts = append(opts, otlptracegrpc.WithTLSCredentials(creds))
}

If that sounds good to maintainers, I'd be glad to submit a PR for it, I'd just like to know I'm barking up the right tree first.

@ms-jcorley
Copy link

I created a PR for a small part of this in the collector repo:
open-telemetry/opentelemetry-collector#11633

@dmathieu
Copy link
Member

cc @pellared @codeboten as code owners.

codeboten added a commit to codeboten/opentelemetry-go-contrib that referenced this issue Nov 27, 2024
@codeboten
Copy link
Contributor

Thanks @mattsains & @ms-jcorley for taking a look at this. I opened a PR that takes the code submitted in open-telemetry/opentelemetry-collector#11633 to get the Certificate config sorted. @mattsains if you have time to open follow up PRs for the other fields that'd be great

mattsains pushed a commit to mattsains/opentelemetry-go-contrib that referenced this issue Dec 2, 2024
codeboten added a commit to codeboten/opentelemetry-go-contrib that referenced this issue Dec 3, 2024
codeboten added a commit to codeboten/opentelemetry-go-contrib that referenced this issue Dec 5, 2024
codeboten added a commit to codeboten/opentelemetry-go-contrib that referenced this issue Dec 6, 2024
codeboten added a commit to codeboten/opentelemetry-go-contrib that referenced this issue Dec 10, 2024
codeboten added a commit to codeboten/opentelemetry-go-contrib that referenced this issue Dec 10, 2024
MrAlias pushed a commit that referenced this issue Dec 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: config Related to config functionality bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants