-
Notifications
You must be signed in to change notification settings - Fork 107
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
Improve logging with open telemetry traces #9083
Conversation
Adds a top level trace to ert. Add a span processor through the add_span_processor pluggin hook to export the trace to e.g. azure
Set current span with deocrator instead of with statements and remove span.add_event functions as these are redundant to already existing logging
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #9083 +/- ##
==========================================
+ Coverage 90.69% 90.72% +0.02%
==========================================
Files 349 351 +2
Lines 21768 21834 +66
==========================================
+ Hits 19742 19808 +66
Misses 2026 2026
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
with tracer.start_as_current_span("test_span"): | ||
print("test_span") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe best to use different strings for these? You are testing the logged content of the span, not the name of the span.
Also, would it be possible to create two spans, and log to both, seeing that they would separate logging as intended?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Changed the strings, and added an extra span. The test seeks to confirm that the add_span_processor plugin hook works, by confirming that span information is written to the span_output object of the dummy_plugins module.
self.started.clear() | ||
else: | ||
await self._send(JobState.FAILED) | ||
with tracer.start_as_current_span(f"{__name__}.run.realization_{self.iens}"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess we might be a little lucky here since the scope will cover most, if not all, of the functions in this class. 👍
|
||
resource = Resource(attributes={SERVICE_NAME: "ert"}) | ||
tracer_provider = TracerProvider( | ||
resource=resource, span_limits=SpanLimits(max_events=128 * 16) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suspect this number is much higher than what we really need, but let's leave it like this for the time being.
Events within a span are meant for noticeable changes like exceptions, outcomes and such.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work! 🏖️
Adds a top level trace to ert.
Add a span processor through the add_span_processor pluggin hook to export the trace to e.g. azure
Issue
Resolves #8588
Approach
Short description of the approach
(Screenshot of new behavior in GUI if applicable)
git rebase -i main --exec 'pytest tests/ert/unit_tests -n logical -m "not integration_test"'
)When applicable