Skip to content

Conversation

@suranjay
Copy link
Owner

@suranjay suranjay commented May 7, 2023

Description

[Describe what this change achieves]

Issues Resolved

[List any issues this PR will resolve]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff
  • Commit changes are listed out in CHANGELOG.md file (See: Changelog)

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.

@github-actions
Copy link

github-actions bot commented May 7, 2023

Gradle Check (Jenkins) Run Completed with:

  • RESULT: null ❌
  • URL:
  • CommitID: 3e93e36
    Please examine the workflow log, locate, and copy-paste the failure(s) below, then iterate to green.
    Is the failure a flaky test unrelated to your change?

} finally {
if (request.uri().startsWith("/_search")) {

System.out.println("ending base request:" + request.getRequestId());
Copy link
Collaborator

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
Copy link
Collaborator

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);
Copy link
Collaborator

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(),
Copy link
Collaborator

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) {
Copy link
Collaborator

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();
Copy link
Collaborator

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());
Copy link
Collaborator

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)) {
Copy link
Collaborator

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) {
Copy link
Collaborator

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 + "], " +
Copy link
Collaborator

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?

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.

3 participants