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 logs to OpenTelemetry traces #6294

Merged
merged 1 commit into from
Oct 14, 2022

Conversation

saschagrunert
Copy link
Member

What type of PR is this?

/kind feature

What this PR does / why we need it:

We now use the log interceptor to enrich the otel traces with additional data. For example we now have detailed logging information from CRI-O and propagate the error to the traces.

Which issue(s) this PR fixes:

None

Special notes for your reviewer:

For example, the output now looks like this on container creation:

screenshot

And the error propagation looks like this:

screenshot

Side note: We need the additional span to capture most of the logs, otherwise we will miss some information (see the error propagation).

cc @sallyom

Does this PR introduce a user-facing change?

Added logs and GRPC error codes to OpenTelemetry traces.

@openshift-ci openshift-ci bot added the release-note Denotes a PR that will be considered when it comes time to generate release notes. label Oct 11, 2022
@openshift-ci openshift-ci bot added kind/feature Categorizes issue or PR as related to a new feature. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. labels Oct 11, 2022
@openshift-ci openshift-ci bot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Oct 11, 2022
@saschagrunert saschagrunert force-pushed the otel-logs branch 3 times, most recently from 00e61f0 to 99e9ddf Compare October 11, 2022 11:35
@codecov
Copy link

codecov bot commented Oct 11, 2022

Codecov Report

Merging #6294 (3168305) into main (cfdd085) will increase coverage by 0.04%.
The diff coverage is 82.35%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #6294      +/-   ##
==========================================
+ Coverage   44.17%   44.21%   +0.04%     
==========================================
  Files         122      122              
  Lines       13846    13862      +16     
==========================================
+ Hits         6116     6129      +13     
- Misses       7058     7061       +3     
  Partials      672      672              

@saschagrunert
Copy link
Member Author

/retest

@saschagrunert
Copy link
Member Author

/retest-required

1 similar comment
@saschagrunert
Copy link
Member Author

/retest-required

@haircommander
Copy link
Member

wow very cool! are there guidelines on the format of traces? we had to update prometheus metrics because we didn't specify them efficiently, and I'd like to avoid that with otel if possible

@saschagrunert
Copy link
Member Author

/retest

@saschagrunert
Copy link
Member Author

/retest-required

Copy link
Contributor

@sallyom sallyom left a comment

Choose a reason for hiding this comment

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

nice! AFIAK there are no definite guidelines for trace content - and attributes to correlate logs will be useful.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 12, 2022

@sallyom: changing LGTM is restricted to collaborators

In response to this:

nice! AFIAK there are no definite guidelines for trace content - and attributes to correlate logs will be useful.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 12, 2022

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: sallyom, 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

We now use the log interceptor to enrich the otel traces with additional
data. For example we now have detailed logging information from CRI-O
and propagate the error to the traces.

Signed-off-by: Sascha Grunert <[email protected]>
@saschagrunert
Copy link
Member Author

nice! AFIAK there are no definite guidelines for trace content - and attributes to correlate logs will be useful.

Thank you! PTAL @haircommander

Comment on lines +55 to +56
trace.SpanFromContext(ctx).AddEvent(fmt.Sprintf(format, args...), trace.WithAttributes(
attribute.String("level", level),
Copy link
Member Author

Choose a reason for hiding this comment

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

The log message now goes directly into the events field, which is streamlined with conmon-rs.

@haircommander
Copy link
Member

/lgtm

@openshift-ci openshift-ci bot added the lgtm Indicates that a PR is ready to be merged. label Oct 13, 2022
@saschagrunert
Copy link
Member Author

/override ci/prow/e2e-gcp

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 14, 2022

@saschagrunert: Overrode contexts on behalf of saschagrunert: ci/prow/e2e-gcp

In response to this:

/override ci/prow/e2e-gcp

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@saschagrunert
Copy link
Member Author

/override ci/prow/ci-cgroupv2-e2e

Seems to be stuck in merge pool 🤔

@openshift-ci
Copy link
Contributor

openshift-ci bot commented Oct 14, 2022

@saschagrunert: Overrode contexts on behalf of saschagrunert: ci/prow/ci-cgroupv2-e2e

In response to this:

/override ci/prow/ci-cgroupv2-e2e

Seems to be stuck in merge pool 🤔

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@openshift-merge-robot openshift-merge-robot merged commit a2da006 into cri-o:main Oct 14, 2022
@saschagrunert saschagrunert deleted the otel-logs branch October 14, 2022 07:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. dco-signoff: yes Indicates the PR's author has DCO signed all their commits. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Denotes a PR that will be considered when it comes time to generate release notes.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants