Skip to content

Commit

Permalink
testing-instrumentation
Browse files Browse the repository at this point in the history
Signed-off-by: Sarthak Aggarwal <sarthagg@amazon.com>
  • Loading branch information
sarthakaggarwal97 committed Sep 20, 2023
1 parent 9e8fe99 commit 3a93b31
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 14 deletions.
8 changes: 4 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -724,14 +724,14 @@ tasks.named(JavaBasePlugin.CHECK_TASK_NAME) {
dependsOn tasks.named('testAggregateTestReport', TestReport)
}

tasks.register('checkCompatibility', CheckCompatibilityTask) {
description('Checks the compatibility with child components')
}
//tasks.register('checkCompatibility', CheckCompatibilityTask) {
// description('Checks the compatibility with child components')
//}

allprojects { project ->
project.afterEvaluate {
if (project.tasks.findByName('publishToMavenLocal')) {
checkCompatibility.dependsOn(project.tasks.publishToMavenLocal)
// checkCompatibility.dependsOn(project.tasks.publishToMavenLocal)
}
}
}
2 changes: 1 addition & 1 deletion buildSrc/version.properties
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,4 @@ jzlib = 1.1.3
resteasy = 6.2.4.Final

# opentelemetry dependencies
opentelemetry = 1.30.1
opentelemetry = 1.26.0
4 changes: 4 additions & 0 deletions distribution/src/config/opensearch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -121,3 +121,7 @@ ${path.logs}
# index searcher threadpool.
#
#opensearch.experimental.feature.concurrent_segment_search.enabled: false

telemetry.otel.tracer.span.exporter.class: io.opentelemetry.exporter.otlp.trace.OtlpGrpcSpanExporter
bootstrap.system_call_filter: false
telemetry.tracer.sampler.probability: 1.0
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,15 @@
import org.opensearch.indices.SystemIndices;
import org.opensearch.node.NodeClosedException;
import org.opensearch.tasks.Task;
import org.opensearch.telemetry.tracing.ScopedSpan;
import org.opensearch.telemetry.tracing.Span;
import org.opensearch.telemetry.tracing.SpanBuilder;
import org.opensearch.telemetry.tracing.SpanCreationContext;
import org.opensearch.telemetry.tracing.SpanScope;
import org.opensearch.telemetry.tracing.Tracer;
import org.opensearch.telemetry.tracing.TracerFactory;
import org.opensearch.telemetry.tracing.attributes.Attributes;
import org.opensearch.telemetry.tracing.noop.NoopTracer;
import org.opensearch.threadpool.ThreadPool;
import org.opensearch.threadpool.ThreadPool.Names;
import org.opensearch.transport.TransportChannel;
Expand Down Expand Up @@ -139,6 +147,8 @@ public class TransportShardBulkAction extends TransportWriteAction<BulkShardRequ
private final SegmentReplicationPressureService segmentReplicationPressureService;
private final RemoteStorePressureService remoteStorePressureService;

private static Tracer tracer;

/**
* This action is used for performing primary term validation. With remote translog enabled, the translogs would
* be durably persisted in remote store. Without remote translog, current transport replication calls does primary
Expand Down Expand Up @@ -197,6 +207,7 @@ public TransportShardBulkAction(
PrimaryTermValidationRequest::new,
this::handlePrimaryTermValidationRequest
);
TransportShardBulkAction.tracer = tracer;
}

protected void handlePrimaryTermValidationRequest(
Expand Down Expand Up @@ -619,15 +630,19 @@ static boolean executeBulkItemRequest(
);
} else {
final IndexRequest request = context.getRequestToExecute();
result = primary.applyIndexOperationOnPrimary(
version,
request.versionType(),
new SourceToParse(request.index(), request.id(), request.source(), request.getContentType(), request.routing()),
request.ifSeqNo(),
request.ifPrimaryTerm(),
request.getAutoGeneratedTimestamp(),
request.isRetry()
);
// Span span = tracer.startSpan("applyIndexOperationOnPrimary", Attributes.create().addAttribute("index", request.index()));
try (ScopedSpan spanScope = tracer.startScopedSpan(new SpanCreationContext("applyIndexOperationOnPrimary", Attributes.create().addAttribute("index", request.index())))){
// try (SpanScope spanScope = tracer.withSpanInScope(span)){
result = primary.applyIndexOperationOnPrimary(
version,
request.versionType(),
new SourceToParse(request.index(), request.id(), request.source(), request.getContentType(), request.routing()),
request.ifSeqNo(),
request.ifPrimaryTerm(),
request.getAutoGeneratedTimestamp(),
request.isRetry()
);
}
}
if (result.getResultType() == Engine.Result.Type.MAPPING_UPDATE_REQUIRED) {

Expand Down

0 comments on commit 3a93b31

Please sign in to comment.