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

Add support for OpenTelemetry tracing via OTLP #785

Merged
merged 1 commit into from
Oct 10, 2022

Conversation

saschagrunert
Copy link
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

This allows using the GRPC endpoint of an OTLP exporter to export span-based telemetry data directly from conmon-rs.

Which issue(s) this PR fixes:

Fixes tokio-rs/tracing#481

Special notes for your reviewer:

Demo:

For usage with the current CRI-O main we have to manually force-enable tracing:

diff --git a/conmon-rs/server/src/config.rs b/conmon-rs/server/src/config.rs
index 98f99ed..f2b5ff2 100644
--- a/conmon-rs/server/src/config.rs
+++ b/conmon-rs/server/src/config.rs
@@ -113,6 +113,7 @@ pub struct Config {
         env(concat!(prefix!(), "ENABLE_TRACING")),
         long("enable-tracing"),
         short('e'),
+        default_value("true"),
     )]
     /// Enable OpenTelemetry tracing.
     enable_tracing: bool,

Then we can give it a try:

> cargo build
> cd contrib/tracing/ && docker-compose up
> cd /path/to/cri-o
> sudo crictl run test/testdata/container_redis.json test/testdata/sandbox_config.json && sudo crictl rmp -fa

Opening Jaeger UI on http://localhost:16686 does now show the conmonrs service:
1

And the spans contain the relevant information:
2

There seems to be a bug that spans are missing from the telemetry, which should be fixed before used in production:
open-telemetry/opentelemetry-rust#888, tokio-rs/tracing-opentelemetry#58

Does this PR introduce a user-facing change?

Added support for OpenTelemetry OTLP GRPC tracing via `--enable-tracing` and `--tracing-endpoint`.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 10, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: saschagrunert

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@codecov-commenter
Copy link

Codecov Report

Merging #785 (d667c7f) into main (2521c24) will decrease coverage by 0.08%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     tokio-rs/tracing#785      +/-   ##
==========================================
- Coverage   31.35%   31.26%   -0.09%     
==========================================
  Files          13       13              
  Lines        1129     1129              
  Branches      429      427       -2     
==========================================
- Hits          354      353       -1     
- Misses        492      494       +2     
+ Partials      283      282       -1     

This allows using the GRPC endpoint of an OTLP exporter to export
span-based telemetry data directly from conmon-rs.

Signed-off-by: Sascha Grunert <sgrunert@redhat.com>
@saschagrunert
Copy link
Member Author

Green CI, PTAL @haircommander @rphillips.

@rphillips
Copy link
Collaborator

/lgtm

@openshift-ci openshift-ci bot added the lgtm label Oct 10, 2022
@openshift-merge-robot openshift-merge-robot merged commit 43f6697 into containers:main Oct 10, 2022
@saschagrunert saschagrunert deleted the tracing branch October 10, 2022 16:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants