-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add tracetest example for testing instrumentation #7074
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
base: main
Are you sure you want to change the base?
Conversation
Signed-off-by: adity1raut <[email protected]>
@pellared , |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7074 +/- ##
=====================================
Coverage 82.9% 82.9%
=====================================
Files 262 262
Lines 24460 24460
=====================================
Hits 20281 20281
Misses 3801 3801
Partials 378 378 🚀 New features to boost your workflow:
|
@pellared |
In my opinion the following is still not resolved:
Can you please refactor the example so that it is more similar to https://github.com/open-telemetry/opentelemetry-go/blob/main/log/logtest/example_test.go? This means e.g.:
|
Thank you for the feedback @pellared , I understand now that the example should closely follow the structure of log/logtest/example_test.go. I will refactor the code to include: 1,A single test example I’ll make these changes shortly. Please let me know if there’s anything else I should consider. |
Signed-off-by: adity1raut <[email protected]>
I would recommend not using AI to generate the code and your responses on this PR. You'll learn a lot more in the process. |
Thank you for the suggestion. I understand Your point and will make sure to work through the code and Responses on my own to learn Better from the process. However, I did use AI for some minor corrections while solving the issue. I appreciate your guidance |
Signed-off-by: adity1raut <[email protected]>
Sir, I am getting this error, but when I check it on my local system, it doesn't show any error, Could you please guide me on how to solve this issue? |
Signed-off-by: adity1raut <[email protected]>
This is still not a runnable example (you also removed some of the recommended changes from earlier, such as the global tracer provider). I would recommend looking into https://go.dev/blog/examples to better understand what runnable examples are in Go. |
Thank you for your valuable feedback sir I will learn and update a code |
Signed-off-by: adity1raut <[email protected]>
@pellared The PR is ready for review. Please have a look when you get time. |
![]() Hi @dmathieu , this is the output you were looking for. Can I go ahead and push the code? |
0c95830
to
cd09e80
Compare
This input only says the tests pass. So sure, push away. |
I pushed the code |
defer func() { |
Co-authored-by: Damien Mathieu <[email protected]>
Co-authored-by: Damien Mathieu <[email protected]>
Yes, ignoring the error with an anonymous function should fix the linter. |
Printing error is Better or not |
@dmathieu , please clarify, then I will make the necessary changes in the code |
No, printing the error makes no sense in the context of this example. |
I will change the code. Please check the PR. |
Fixes #7051
This PR adds a basic example demonstrating how to test tracing instrumentation using the
tracetest.SpanRecorder
from the OpenTelemetry SDK.✅ It ensures:
Inspired by:
logtest
package example