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

feat: add kernelVersion to telemetry traces #1094

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Anirudh2112
Copy link

Description

This pull request adds the kernelVersion property to telemetry traces in the TrackTrace method. This enhancement allows pinpointing the specific kernel version responsible for producing logs.

To achieve this:

Introduced a kernelVersionFunc variable to enable easier mocking during tests.
Updated the TrackTrace method to include kernelVersion in telemetry traces.
Added a test (TestTrackTraceIncludesKernelVersion) to verify the inclusion of kernelVersion in trace properties.
Related Issue
This pull request addresses the issue:
#1071

Checklist

I have read the contributing documentation
I signed and signed-off the commits (git commit -S -s ...).
I have tested the changes locally.
I have followed the project's style guidelines.
I have added tests.

Screenshots (if applicable) or Testing Completed

Test Output

The following test passes successfully:

  • go test -run TestTrackTraceIncludesKernelVersion

@Anirudh2112 Anirudh2112 requested a review from a team as a code owner December 2, 2024 17:28
@Anirudh2112
Copy link
Author

@microsoft-github-policy-service agree

pkg/telemetry/telemetry.go Outdated Show resolved Hide resolved
pkg/telemetry/telemetry.go Outdated Show resolved Hide resolved
@Anirudh2112 Anirudh2112 force-pushed the add-kernelversion-to-traces branch 2 times, most recently from b9a34f3 to bc6557b Compare December 2, 2024 22:41
pkg/telemetry/telemetry.go Outdated Show resolved Hide resolved
@Anirudh2112
Copy link
Author

Yes, @matmerr that is true, and thank you @rbtr for catching that. I’ve updated the conditional to check for err != nil to avoid infinite recursion. Please let me know if there are any other concerns.

@rbtr
Copy link
Collaborator

rbtr commented Dec 2, 2024

@Anirudh2112 the infinite recursion is still present, trackWarning calls TrackTrace

@Anirudh2112 Anirudh2112 force-pushed the add-kernelversion-to-traces branch from 70fd88e to ad29b29 Compare December 2, 2024 23:33
@Anirudh2112
Copy link
Author

Apologies for the oversight regarding the infinite recursion. In the recent changes, I’ve addressed this by:

  1. Replacing the call to t.trackWarning with direct error logging to avoid recursion.
  2. Ensuring that errors are logged as separate telemetry traces using appinsights.NewTraceTelemetry.
  3. Preserving the original functionality by adding kernelVersion to the properties map when available and maintaining the flow for the main trace.

@Anirudh2112 Anirudh2112 force-pushed the add-kernelversion-to-traces branch from 503c6d6 to f514bbb Compare December 5, 2024 23:42
@Anirudh2112 Anirudh2112 requested a review from matmerr December 14, 2024 19:46
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