Skip to content

Commit

Permalink
Can match phase fix
Browse files Browse the repository at this point in the history
Signed-off-by: David Zane <[email protected]>
  • Loading branch information
dzane17 committed Jan 26, 2024
1 parent 8d9e4a1 commit 7903461
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -443,7 +443,10 @@ private void onPhaseEnd(SearchRequestContext searchRequestContext) {

private void onPhaseStart(SearchPhase phase, SearchRequestContext searchRequestContext) {
setCurrentPhase(phase);
this.searchRequestContext.getSearchRequestOperationsListener().onPhaseStart(this, searchRequestContext);
try {
SearchPhaseName.valueOf(phase.getSearchPhaseName().toString());
this.searchRequestContext.getSearchRequestOperationsListener().onPhaseStart(this, searchRequestContext);
} catch (IllegalArgumentException ignored) {}
}

private void onRequestEnd(SearchRequestContext searchRequestContext) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import org.opensearch.common.annotation.InternalApi;
import org.opensearch.telemetry.tracing.Span;
import org.opensearch.telemetry.tracing.Tracer;
import org.opensearch.telemetry.tracing.noop.NoopSpan;
import org.opensearch.telemetry.tracing.noop.NoopTracer;

import java.util.EnumMap;
Expand Down Expand Up @@ -63,10 +64,12 @@ class SearchRequestContext {
SearchRequestContext(SearchRequest searchRequest, SearchRequestOperationsListener searchRequestOperationsListener, Tracer tracer) {
this.searchRequest = searchRequest;
this.searchRequestOperationsListener = searchRequestOperationsListener;
this.tracer = tracer;
this.absoluteStartNanos = System.nanoTime();
this.phaseTookMap = new HashMap<>();
this.shardStats = new EnumMap<>(ShardStatsFieldNames.class);
this.tracer = tracer;
this.requestSpan = NoopSpan.INSTANCE;
this.phaseSpan = NoopSpan.INSTANCE;
}

public SearchRequest getSearchRequest() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,6 @@ public SearchRequestCoordinatorTrace(Tracer tracer) {

@Override
void onPhaseStart(SearchPhaseContext context, SearchRequestContext searchRequestContext) {
if (searchRequestContext.getPhaseSpan() != null) {
searchRequestContext.getPhaseSpan().endSpan();
}
searchRequestContext.setPhaseSpan(
tracer.startSpan(
SpanBuilder.from(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1346,7 +1346,7 @@ private AbstractSearchAsyncAction<? extends SearchPhaseResult> searchAsyncAction
clusters,
searchRequestContext
);
return new SearchPhase(action.getName()) {
return new SearchPhase("none") {
@Override
public void run() {
action.start();
Expand Down

0 comments on commit 7903461

Please sign in to comment.