Skip to content
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

chore: moved span names processing to a tracer component #565

Merged
merged 6 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import com.epam.aidial.core.server.service.ShareService;
import com.epam.aidial.core.server.service.VertxTimerService;
import com.epam.aidial.core.server.token.TokenStatsTracker;
import com.epam.aidial.core.server.tracing.DialTracingFactory;
import com.epam.aidial.core.server.upstream.UpstreamRouteProvider;
import com.epam.aidial.core.server.util.ProxyUtil;
import com.epam.aidial.core.storage.blobstore.BlobStorage;
Expand Down Expand Up @@ -321,7 +322,9 @@ private static void setupTracing(VertxOptions vertxOptions) {
System.setProperty("otel.traces.exporter", "none");
}
OpenTelemetry openTelemetry = AutoConfiguredOpenTelemetrySdk.builder().build().getOpenTelemetrySdk();
vertxOptions.setTracingOptions(new OpenTelemetryOptions(openTelemetry));
OpenTelemetryOptions otelOpts = new OpenTelemetryOptions(openTelemetry);
otelOpts.setFactory(new DialTracingFactory(otelOpts.getFactory()));
vertxOptions.setTracingOptions(otelOpts);
}

private static String getOtlSetting(String envVar, String systemProperty) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import com.epam.aidial.core.server.config.ConfigStore;
import com.epam.aidial.core.server.controller.Controller;
import com.epam.aidial.core.server.controller.ControllerSelector;
import com.epam.aidial.core.server.controller.ControllerTemplate;
import com.epam.aidial.core.server.data.ApiKeyData;
import com.epam.aidial.core.server.limiter.RateLimiter;
import com.epam.aidial.core.server.log.LogStore;
Expand Down Expand Up @@ -267,7 +268,8 @@ private Future<?> processAuthorizationResult(ExtractedClaims extractedClaims, Co
Future<?> future;
try {
ProxyContext context = new ProxyContext(this, config, request, apiKeyData, extractedClaims, traceId, spanId);
Controller controller = ControllerSelector.select(this, context);
ControllerTemplate controllerTemplate = ControllerSelector.select(request);
Controller controller = controllerTemplate.build(this, context);
future = controller.handle();
} catch (Exception t) {
future = Future.failedFuture(t);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@ public class ProxyContext {
// List of interceptors copied from the deployment config
private List<String> interceptors;
private boolean isStreamingRequest;
private String traceOperation;

public ProxyContext(Proxy proxy, Config config, HttpServerRequest request, ApiKeyData apiKeyData, ExtractedClaims extractedClaims, String traceId, String spanId) {
this.proxy = proxy;
Expand Down
Loading
Loading