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

[EXPORTER] Log SSL Connection Information #3113

Merged
merged 14 commits into from
Nov 6, 2024

Conversation

chusitoo
Copy link
Contributor

@chusitoo chusitoo commented Oct 28, 2024

Fixes #2250

Changes

Enable curl verbose output and add debug function callback to intercept the "interesting" logs.

This functionality is controlled by the compile-time flag/option WITH_CURL_LOGGING=ON but can also be enabled at runtime by setting OtlpHttpExporterOptions::console_debug = true.

By default, all the headers and other information are not available and protected by a compile-time flag since they could contain sensitive information.

An example of info logging related to TLS handshake, available by default:

[Info] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:593 SSL connection using TLSv1.3 / TLS_AES_128_GCM_SHA256 / X25519 / RSASSA-PSS

An example of debug logging, enabled via -DOTEL_CURL_DEBUG:

[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:613 Send header => POST /v1/traces HTTP/2
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:613 Send header => Host: localhost:4318
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:613 Send header => Accept: */*
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:613 Send header => Content-Type: application/x-protobuf
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:613 Send header => User-Agent: OTel-OTLP-Exporter-Cpp/1.17.0
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:613 Send header => Content-Length: 238
[Debug] File: /otel/exporters/otlp/src/otlp_http_client.cc:226 [OTLP HTTP Client] Session state: sending request
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:602 We are completely uploaded and fine
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:620 Recv header => HTTP/2 200
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:620 Recv header => content-type: application/x-protobuf
[Debug] File: /otel/ext/src/http/client/curl/http_operation_curl.cc:620 Recv header => content-length: 2

For significant contributions please make sure you have completed the following items:

  • CHANGELOG.md updated for non-trivial changes
  • Unit tests have been added
  • Changes in public API reviewed

Copy link

netlify bot commented Oct 28, 2024

Deploy Preview for opentelemetry-cpp-api-docs canceled.

Name Link
🔨 Latest commit 17b4c57
🔍 Latest deploy log https://app.netlify.com/sites/opentelemetry-cpp-api-docs/deploys/672bd054d267dd0009641357

@chusitoo chusitoo changed the title Enable curl verbose output and add debug function callback [EXPORTER] Log SSL Connection Information Oct 28, 2024
@chusitoo chusitoo force-pushed the Log_SSL_connection_info branch from 2b36b33 to b2e4069 Compare October 28, 2024 22:36
Copy link

codecov bot commented Oct 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 87.85%. Comparing base (497eaf4) to head (17b4c57).
Report is 156 commits behind head on main.

Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main    #3113      +/-   ##
==========================================
+ Coverage   87.12%   87.85%   +0.73%     
==========================================
  Files         200      195       -5     
  Lines        6109     6138      +29     
==========================================
+ Hits         5322     5392      +70     
+ Misses        787      746      -41     

see 100 files with indirect coverage changes

@chusitoo chusitoo marked this pull request as ready for review October 29, 2024 00:05
@chusitoo chusitoo requested a review from a team as a code owner October 29, 2024 00:05
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

Great work, thanks for the feature.

Reusing console_debug for this is a good idea.

See some comments or questions, with approval to follow once resolved.

ext/src/http/client/curl/http_operation_curl.cc Outdated Show resolved Hide resolved
ext/src/http/client/curl/http_operation_curl.cc Outdated Show resolved Hide resolved
@chusitoo chusitoo force-pushed the Log_SSL_connection_info branch 2 times, most recently from e58cafd to 109efdd Compare November 6, 2024 03:45
@chusitoo chusitoo force-pushed the Log_SSL_connection_info branch from 109efdd to 2ed8e0f Compare November 6, 2024 03:47
Copy link
Member

@lalitb lalitb left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks for the contribution.

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

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

LGTM, thanks for the feature.

@marcalff marcalff merged commit 84d4270 into open-telemetry:main Nov 6, 2024
56 checks passed
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.

Log SSL Connection Information
4 participants