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

config: add support for certificate configuration #6376

Merged
merged 13 commits into from
Dec 12, 2024

Conversation

codeboten
Copy link
Contributor

@codeboten codeboten commented Nov 27, 2024

Part of #6351

@codeboten codeboten requested review from pellared and a team as code owners November 27, 2024 18:24
Copy link

codecov bot commented Nov 27, 2024

Codecov Report

Attention: Patch coverage is 93.75000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 67.9%. Comparing base (0c0b385) to head (a6fed29).
Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
config/v0.3.0/config.go 75.0% 2 Missing and 1 partial ⚠️
Additional details and impacted files

Impacted file tree graph

@@          Coverage Diff          @@
##            main   #6376   +/-   ##
=====================================
  Coverage   67.8%   67.9%           
=====================================
  Files        200     200           
  Lines      16641   16689   +48     
=====================================
+ Hits       11297   11342   +45     
- Misses      4999    5001    +2     
- Partials     345     346    +1     
Files with missing lines Coverage Δ
config/v0.3.0/log.go 95.3% <100.0%> (+0.4%) ⬆️
config/v0.3.0/metric.go 85.8% <100.0%> (+0.4%) ⬆️
config/v0.3.0/trace.go 97.3% <100.0%> (+0.2%) ⬆️
config/v0.3.0/config.go 84.4% <75.0%> (-1.8%) ⬇️

@codeboten
Copy link
Contributor Author

codeboten commented Nov 27, 2024

Not sure if the test failure is related to my change, i don't think so but i could be wrong:

--- FAIL: TestInstrumentation (13.42s)
    instrgen_test.go:87: 
        	Error Trace:	/Users/runner/work/opentelemetry-go-contrib/opentelemetry-go-contrib/instrgen/driver/instrgen_test.go:87
        	Error:      	Should be true
        	Test:       	TestInstrumentation
        	Messages:   	testdata/interface/app/impl.go_pass_tracing
    instrgen_test.go:87: 
        	Error Trace:	/Users/runner/work/opentelemetry-go-contrib/opentelemetry-go-contrib/instrgen/driver/instrgen_test.go:87
        	Error:      	Should be true
        	Test:       	TestInstrumentation
        	Messages:   	testdata/interface/main.go_pass_tracing

Copy link

@mattsains mattsains left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if you consider HTTP (as opposed to GRPC) config to be in scope for this PR, but the otlpHTTPLogExporter has a similar problem - http in this context can also mean https

config/log.go Outdated
@@ -178,6 +180,13 @@ func otlpGRPCLogExporter(ctx context.Context, otlpConfig *OTLP) (sdklog.Exporter
if u.Scheme == "http" {
opts = append(opts, otlploggrpc.WithInsecure())
}
if otlpConfig.Certificate != nil {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm curious about why this was put here and not the outer scope on line 190/191 as a sibling of if otlp.Config.Compression != nil { ? the other if statements in the inner block pertain to the result of url.ParseRequestURI, so if you think it's better to put otlpConfig checks in this block, it would be good to understand when to add them here and when to add them in the outer scope

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i ended up moving the code after thinking about this further. originally i thought it made sense to only have it in the case where an endpoint was configured, but after rethinking through it i moved it out at the same level as compression and the other parameters. figured if there was a problem with the cert config it would make sense to surface it regardless of what the endpoint configuration is

@codeboten
Copy link
Contributor Author

I'm not sure if you consider HTTP (as opposed to GRPC) config to be in scope for this PR, but the otlpHTTPLogExporter has a similar problem - http in this context can also mean https

I was planning on submitting a separate PR for the http exporter

@mattsains
Copy link

I'm not sure if you consider HTTP (as opposed to GRPC) config to be in scope for this PR, but the otlpHTTPLogExporter has a similar problem - http in this context can also mean https

I was planning on submitting a separate PR for the http exporter

I'll do the rest of the changes if you're okay with that. Some of the other fields require overwriting this change anyway

@mattsains
Copy link

I created #6378 which is based on this PR

@codeboten
Copy link
Contributor Author

Ah I missed your comment, i ended up implementing the http certificate field in this same PR

.golangci.yml Show resolved Hide resolved
@codeboten codeboten force-pushed the codeboten/add-tls-support-grpc branch from 28cb287 to d57fc1a Compare December 3, 2024 21:21
@codeboten codeboten force-pushed the codeboten/add-tls-support-grpc branch 3 times, most recently from d172dfc to 8d7664e Compare December 10, 2024 16:29
@codeboten
Copy link
Contributor Author

@dmathieu can this be merged? it will unblock #6378

@codeboten codeboten force-pushed the codeboten/add-tls-support-grpc branch from 8d7664e to 2cdf0ca Compare December 10, 2024 19:08
@dmathieu
Copy link
Member

We need a second approval to merge.

@MrAlias MrAlias added this to the v1.33.0 milestone Dec 12, 2024
@MrAlias MrAlias merged commit 741c472 into open-telemetry:main Dec 12, 2024
25 checks passed
@codeboten codeboten deleted the codeboten/add-tls-support-grpc branch December 12, 2024 18:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants