-
Notifications
You must be signed in to change notification settings - Fork 2
Main otel commit latest search #3
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-otel-commit-latest
Are you sure you want to change the base?
Conversation
Gradle Check (Jenkins) Run Completed with:
|
| } finally { | ||
| if (request.uri().startsWith("/_search")) { | ||
|
|
||
| System.out.println("ending base request:" + request.getRequestId()); |
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.
Pls remove sysout.
| import java.util.Optional; | ||
|
|
||
| /** | ||
| * This class encapsulates the state needed to execute a search. It holds a reference to the |
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.
Please update the javadoc.
| } | ||
|
|
||
| private NoopSpan createNoopSpan(String spanName, Span parentSpan, Level level) { | ||
| logger.info("Starting Noop span name:{}", spanName); |
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.
Should be a debug log.
| OSSpan parentOSSpan = getLastOSSpanInChain(parentSpan); | ||
| io.opentelemetry.api.trace.Span otelSpan = createOtelSpan(spanName, parentOSSpan); | ||
| Span span = new OSSpan(spanName, otelSpan, parentOSSpan, level); | ||
| logger.info("Starting OtelSpan spanId:{} name:{}: traceId:{}", otelSpan.getSpanContext().getSpanId(), |
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.
Should be a debug log.
|
|
||
| private void addSingleAttribute(String key, Object value, Span currentSpan) { | ||
| if (currentSpan instanceof OSSpan && ((OSSpan) currentSpan).getOtelSpan() != null) { | ||
| if (value instanceof String) { |
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.
Switch case if possible.
|
|
||
| private static OSSpan getLastOSSpanInChain(Span span) { | ||
| while (!(span instanceof OSSpan)) { | ||
| span = span.getParentSpan(); |
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.
Why are you reusing the parameter variable and handle null otherwise null.getParentSpan will throw NPE.
| osSpan.getSpanContext().getTraceId()); | ||
| osSpan.getOtelSpan().end(); | ||
| } else { | ||
| logger.info("Ending noop span name:{}", span.getSpanName()); |
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.
In case of Noop also shouldn't we setting the Noop's parent as new current?
| } | ||
|
|
||
| private OSSpan getLastOSSpanInChain(Span parentSpan) { | ||
| while (!(parentSpan instanceof OSSpan)) { |
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.
In case of noop can we add an event to the parent may be that this is mapped to this parent becuase of noop span in-between. Also lets' update the documentation on how level works. May be in the Levels enum.
| this.order = order; | ||
| } | ||
|
|
||
| public boolean isHigherThan(Level level) { |
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.
Let's keep this logic here. So that we don't replicate the same at multiple places.
| return level; | ||
| } | ||
| } | ||
| throw new IllegalArgumentException("invalid value for tracing level [" + type + "], " + |
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.
Pls check if this can be validated upfront instead if throwing an exception from here. Also validate if this exception will bring down the ES process?
Description
[Describe what this change achieves]
Issues Resolved
[List any issues this PR will resolve]
Check List
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.