diff --git a/server/src/main/java/io/deephaven/server/arrow/ArrowFlightUtil.java b/server/src/main/java/io/deephaven/server/arrow/ArrowFlightUtil.java index dde14602afc..01d498bdb74 100644 --- a/server/src/main/java/io/deephaven/server/arrow/ArrowFlightUtil.java +++ b/server/src/main/java/io/deephaven/server/arrow/ArrowFlightUtil.java @@ -77,14 +77,9 @@ public static void DoGetCustom( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request, "ArrowFlightUtil"); - - final SessionState.ExportObject> export; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - export = ticketRouter.resolve(session, request, "request"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject> export = + ticketRouter.resolve(session, request, "request"); final BarragePerformanceLog.SnapshotMetricsHelper metrics = new BarragePerformanceLog.SnapshotMetricsHelper(); @@ -497,15 +492,9 @@ public void handleMessage(@NotNull final BarrageProtoUtil.MessageInfo message) { final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor( - snapshotRequest.ticketAsByteBuffer(), "ArrowFlightUtil"); - - final SessionState.ExportObject> parent; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - parent = ticketRouter.resolve(session, snapshotRequest.ticketAsByteBuffer(), "parent"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject> parent = + ticketRouter.resolve(session, snapshotRequest.ticketAsByteBuffer(), "parent"); final BarragePerformanceLog.SnapshotMetricsHelper metrics = new BarragePerformanceLog.SnapshotMetricsHelper(); @@ -658,15 +647,9 @@ public void handleMessage(@NotNull final MessageInfo message) { final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor( - subscriptionRequest.ticketAsByteBuffer(), "ArrowFlightUtil"); - - final SessionState.ExportObject parent; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - parent = ticketRouter.resolve(session, subscriptionRequest.ticketAsByteBuffer(), "parent"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject parent = + ticketRouter.resolve(session, subscriptionRequest.ticketAsByteBuffer(), "parent"); synchronized (this) { onExportResolvedContinuation = session.nonExport() diff --git a/server/src/main/java/io/deephaven/server/arrow/FlightServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/arrow/FlightServiceGrpcImpl.java index 23aec4f61b8..ed1c6ccbbc0 100644 --- a/server/src/main/java/io/deephaven/server/arrow/FlightServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/arrow/FlightServiceGrpcImpl.java @@ -182,12 +182,9 @@ public void getFlightInfo( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - - final SessionState.ExportObject export; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget("flightInfoFor")) { - export = ticketRouter.flightInfoFor(session, request, "request"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject export = + ticketRouter.flightInfoFor(session, request, "request"); if (session != null) { session.nonExport() @@ -239,12 +236,9 @@ public void getSchema( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - - final SessionState.ExportObject export; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget("flightInfoFor")) { - export = ticketRouter.flightInfoFor(session, request, "request"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject export = + ticketRouter.flightInfoFor(session, request, "request"); if (session != null) { session.nonExport() diff --git a/server/src/main/java/io/deephaven/server/console/ConsoleServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/console/ConsoleServiceGrpcImpl.java index 72554f7cb31..b4a0d7b2804 100644 --- a/server/src/main/java/io/deephaven/server/console/ConsoleServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/console/ConsoleServiceGrpcImpl.java @@ -171,14 +171,9 @@ public void executeCommand( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(consoleId, "consoleId"); - - final SessionState.ExportObject exportedConsole; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - exportedConsole = ticketRouter.resolve(session, consoleId, "consoleId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject exportedConsole = + ticketRouter.resolve(session, consoleId, "consoleId"); session.nonExport() .queryPerformanceRecorder(queryPerformanceRecorder) @@ -261,14 +256,9 @@ public void bindTableToVariable( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String tableTicketName = ticketRouter.getLogNameFor(tableId, "tableId"); - - final SessionState.ExportObject exportedTable; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTableTicket:" + tableTicketName)) { - exportedTable = ticketRouter.resolve(session, tableId, "tableId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
exportedTable = + ticketRouter.resolve(session, tableId, "tableId"); final SessionState.ExportObject exportedConsole; @@ -278,12 +268,7 @@ public void bindTableToVariable( .onError(responseObserver); if (request.hasConsoleId()) { - final String consoleTicketName = ticketRouter.getLogNameFor(request.getConsoleId(), "consoleId"); - - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveConsoleTicket:" + consoleTicketName)) { - exportedConsole = ticketRouter.resolve(session, request.getConsoleId(), "consoleId"); - } + exportedConsole = ticketRouter.resolve(session, request.getConsoleId(), "consoleId"); exportBuilder.require(exportedTable, exportedConsole); } else { exportedConsole = null; diff --git a/server/src/main/java/io/deephaven/server/hierarchicaltable/HierarchicalTableServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/hierarchicaltable/HierarchicalTableServiceGrpcImpl.java index 00d88e1cd07..22b71097e6d 100644 --- a/server/src/main/java/io/deephaven/server/hierarchicaltable/HierarchicalTableServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/hierarchicaltable/HierarchicalTableServiceGrpcImpl.java @@ -80,15 +80,9 @@ public void rollup( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request.getSourceTableId(), - "HierarchicalTableServiceGrpcImpl"); - - final SessionState.ExportObject
sourceTableExport; - try (final SafeCloseable ignored2 = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - sourceTableExport = ticketRouter.resolve(session, request.getSourceTableId(), "rollup.sourceTableId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
sourceTableExport = + ticketRouter.resolve(session, request.getSourceTableId(), "rollup.sourceTableId"); session.newExport(request.getResultRollupTableId(), "rollup.resultRollupTableId") .queryPerformanceRecorder(queryPerformanceRecorder) @@ -137,15 +131,9 @@ public void tree( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request.getSourceTableId(), - "HierarchicalTableServiceGrpcImpl"); - - final SessionState.ExportObject
sourceTableExport; - try (final SafeCloseable ignored2 = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - sourceTableExport = ticketRouter.resolve(session, request.getSourceTableId(), "tree.sourceTableId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
sourceTableExport = + ticketRouter.resolve(session, request.getSourceTableId(), "tree.sourceTableId"); session.newExport(request.getResultTreeTableId(), "tree.resultTreeTableId") .queryPerformanceRecorder(queryPerformanceRecorder) @@ -199,16 +187,10 @@ public void apply( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request.getInputHierarchicalTableId(), - "HierarchicalTableServiceGrpcImpl"); - - final SessionState.ExportObject> inputHierarchicalTableExport; - try (final SafeCloseable ignored2 = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - inputHierarchicalTableExport = ticketRouter.resolve( - session, request.getInputHierarchicalTableId(), "apply.inputHierarchicalTableId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject> inputHierarchicalTableExport = + ticketRouter.resolve(session, request.getInputHierarchicalTableId(), + "apply.inputHierarchicalTableId"); session.newExport(request.getResultHierarchicalTableId(), "apply.resultHierarchicalTableId") .queryPerformanceRecorder(queryPerformanceRecorder) @@ -362,7 +344,7 @@ public void view( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { final SessionState.ExportBuilder resultExportBuilder = session.newExport(request.getResultViewId(), "view.resultViewId"); @@ -382,21 +364,13 @@ public void view( default: throw new IllegalStateException(); } - final String ticketName = ticketRouter.getLogNameFor(request.getResultViewId(), - "HierarchicalTableServiceGrpcImpl"); - final SessionState.ExportObject targetExport; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance() - .getNugget("resolveTargetTicket:" + ticketName)) { - targetExport = ticketRouter.resolve(session, targetTicket, "view.target"); - } + final SessionState.ExportObject targetExport = + ticketRouter.resolve(session, targetTicket, "view.target"); final SessionState.ExportObject
keyTableExport; if (request.hasExpansions()) { - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance() - .getNugget("resolveExpansionsTicket:" + ticketName)) { - keyTableExport = ticketRouter.resolve( - session, request.getExpansions().getKeyTableId(), "view.expansions.keyTableId"); - } + keyTableExport = ticketRouter.resolve( + session, request.getExpansions().getKeyTableId(), "view.expansions.keyTableId"); resultExportBuilder.require(targetExport, keyTableExport); } else { keyTableExport = null; @@ -486,16 +460,10 @@ public void exportSource( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request.getHierarchicalTableId(), - "HierarchicalTableServiceGrpcImpl"); - - final SessionState.ExportObject> hierarchicalTableExport; - try (final SafeCloseable ignored2 = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - hierarchicalTableExport = ticketRouter.resolve( - session, request.getHierarchicalTableId(), "exportSource.hierarchicalTableId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject> hierarchicalTableExport = + ticketRouter.resolve(session, request.getHierarchicalTableId(), + "exportSource.hierarchicalTableId"); session.newExport(request.getResultTableId(), "exportSource.resultTableId") .queryPerformanceRecorder(queryPerformanceRecorder) diff --git a/server/src/main/java/io/deephaven/server/object/ObjectServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/object/ObjectServiceGrpcImpl.java index 7df54bd6a9c..5b17def4b76 100644 --- a/server/src/main/java/io/deephaven/server/object/ObjectServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/object/ObjectServiceGrpcImpl.java @@ -265,14 +265,9 @@ public void fetchObject( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request.getSourceId().getTicket(), "sourceId"); - - final SessionState.ExportObject object; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - object = ticketRouter.resolve(session, request.getSourceId().getTicket(), "sourceId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject object = + ticketRouter.resolve(session, request.getSourceId().getTicket(), "sourceId"); session.nonExport() .queryPerformanceRecorder(queryPerformanceRecorder) diff --git a/server/src/main/java/io/deephaven/server/partitionedtable/PartitionedTableServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/partitionedtable/PartitionedTableServiceGrpcImpl.java index 1f55fc94072..eb466ee7a57 100644 --- a/server/src/main/java/io/deephaven/server/partitionedtable/PartitionedTableServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/partitionedtable/PartitionedTableServiceGrpcImpl.java @@ -63,15 +63,9 @@ public void partitionBy( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor( - request.getTableId(), "PartitionedTableServiceGrpcImpl"); - - final SessionState.ExportObject
targetTable; - try (final SafeCloseable ignored2 = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - targetTable = ticketRouter.resolve(session, request.getTableId(), "partition.tableId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
targetTable = + ticketRouter.resolve(session, request.getTableId(), "partition.tableId"); session.newExport(request.getResultId(), "partition.resultId") .queryPerformanceRecorder(queryPerformanceRecorder) @@ -98,15 +92,9 @@ public void merge( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor( - request.getPartitionedTable(), "PartitionedTableServiceGrpcImpl"); - - final SessionState.ExportObject partitionedTable; - try (final SafeCloseable ignored2 = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - partitionedTable = ticketRouter.resolve(session, request.getPartitionedTable(), "partitionedTable"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject partitionedTable = + ticketRouter.resolve(session, request.getPartitionedTable(), "partitionedTable"); session.newExport(request.getResultId(), "resultId") .queryPerformanceRecorder(queryPerformanceRecorder) @@ -141,22 +129,11 @@ public void getTable( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String partitionTableLogId = ticketRouter.getLogNameFor( - request.getPartitionedTable(), "PartitionedTableServiceGrpcImpl"); - final String keyTableLogId = ticketRouter.getLogNameFor( - request.getKeyTableTicket(), "PartitionedTableServiceGrpcImpl"); - - final SessionState.ExportObject partitionedTable; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolvePartitionTableTicket:" + partitionTableLogId)) { - partitionedTable = ticketRouter.resolve(session, request.getPartitionedTable(), "partitionedTable"); - } - final SessionState.ExportObject
keys; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolvePartitionTableTicket:" + keyTableLogId)) { - keys = ticketRouter.resolve(session, request.getKeyTableTicket(), "keyTableTicket"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject partitionedTable = + ticketRouter.resolve(session, request.getPartitionedTable(), "partitionedTable"); + final SessionState.ExportObject
keys = + ticketRouter.resolve(session, request.getKeyTableTicket(), "keyTableTicket"); session.newExport(request.getResultId(), "resultId") .queryPerformanceRecorder(queryPerformanceRecorder) diff --git a/server/src/main/java/io/deephaven/server/session/SessionServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/session/SessionServiceGrpcImpl.java index 35e17020d3b..f57b4c2c3a6 100644 --- a/server/src/main/java/io/deephaven/server/session/SessionServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/session/SessionServiceGrpcImpl.java @@ -172,15 +172,9 @@ public void exportFromTicket( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor( - request.getSourceId(), "SessionServiceServiceGrpcImpl"); - - final SessionState.ExportObject source; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - source = ticketRouter.resolve(session, request.getSourceId(), "sourceId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject source = + ticketRouter.resolve(session, request.getSourceId(), "sourceId"); session.newExport(request.getResultId(), "resultId") .queryPerformanceRecorder(queryPerformanceRecorder) @@ -215,15 +209,9 @@ public void publishFromTicket( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor( - request.getSourceId(), "SessionServiceServiceGrpcImpl"); - - final SessionState.ExportObject source; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - source = ticketRouter.resolve(session, request.getSourceId(), "sourceId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject source = + ticketRouter.resolve(session, request.getSourceId(), "sourceId"); Ticket resultId = request.getResultId(); diff --git a/server/src/main/java/io/deephaven/server/session/TicketRouter.java b/server/src/main/java/io/deephaven/server/session/TicketRouter.java index fc8375e0411..be67ede097f 100644 --- a/server/src/main/java/io/deephaven/server/session/TicketRouter.java +++ b/server/src/main/java/io/deephaven/server/session/TicketRouter.java @@ -5,6 +5,7 @@ import com.google.rpc.Code; import io.deephaven.engine.table.Table; +import io.deephaven.engine.table.impl.perf.QueryPerformanceRecorder; import io.deephaven.extensions.barrage.util.BarrageUtil; import io.deephaven.hash.KeyedIntObjectHashMap; import io.deephaven.hash.KeyedIntObjectKey; @@ -13,6 +14,7 @@ import io.deephaven.proto.backplane.grpc.Ticket; import io.deephaven.proto.util.Exceptions; import io.deephaven.server.auth.AuthorizationProvider; +import io.deephaven.util.SafeCloseable; import org.apache.arrow.flight.impl.Flight; import org.jetbrains.annotations.Nullable; @@ -22,6 +24,8 @@ import java.util.Set; import java.util.function.Consumer; +import static io.deephaven.proto.flight.util.TicketRouterHelper.getLogNameFor; + @Singleton public class TicketRouter { private final KeyedIntObjectHashMap byteResolverMap = @@ -65,7 +69,11 @@ public SessionState.ExportObject resolve( throw Exceptions.statusRuntimeException(Code.FAILED_PRECONDITION, "could not resolve '" + logId + "' it's an empty ticket"); } - return getResolver(ticket.get(ticket.position()), logId).resolve(session, ticket, logId); + final String ticketName = getLogNameFor(ticket, logId); + try (final SafeCloseable ignored = QueryPerformanceRecorder.getInstance().getNugget( + "resolveTicket:" + ticketName)) { + return getResolver(ticket.get(ticket.position()), logId).resolve(session, ticket, logId); + } } /** @@ -113,7 +121,10 @@ public SessionState.ExportObject resolve( @Nullable final SessionState session, final Flight.FlightDescriptor descriptor, final String logId) { - return getResolver(descriptor, logId).resolve(session, descriptor, logId); + try (final SafeCloseable ignored = QueryPerformanceRecorder.getInstance().getNugget( + "resolveDescriptor:" + descriptor)) { + return getResolver(descriptor, logId).resolve(session, descriptor, logId); + } } /** @@ -134,9 +145,13 @@ public SessionState.ExportBuilder publish( final ByteBuffer ticket, final String logId, @Nullable final Runnable onPublish) { - final TicketResolver resolver = getResolver(ticket.get(ticket.position()), logId); - authorization.authorizePublishRequest(resolver, ticket); - return resolver.publish(session, ticket, logId, onPublish); + final String ticketName = getLogNameFor(ticket, logId); + try (final SafeCloseable ignored = QueryPerformanceRecorder.getInstance().getNugget( + "publishTicket:" + ticketName)) { + final TicketResolver resolver = getResolver(ticket.get(ticket.position()), logId); + authorization.authorizePublishRequest(resolver, ticket); + return resolver.publish(session, ticket, logId, onPublish); + } } /** @@ -201,9 +216,12 @@ public SessionState.ExportBuilder publish( final Flight.FlightDescriptor descriptor, final String logId, @Nullable final Runnable onPublish) { - final TicketResolver resolver = getResolver(descriptor, logId); - authorization.authorizePublishRequest(resolver, descriptor); - return resolver.publish(session, descriptor, logId, onPublish); + try (final SafeCloseable ignored = QueryPerformanceRecorder.getInstance().getNugget( + "publishDescriptor:" + descriptor)) { + final TicketResolver resolver = getResolver(descriptor, logId); + authorization.authorizePublishRequest(resolver, descriptor); + return resolver.publish(session, descriptor, logId, onPublish); + } } /** @@ -220,7 +238,10 @@ public SessionState.ExportObject flightInfoFor( @Nullable final SessionState session, final Flight.FlightDescriptor descriptor, final String logId) { - return getResolver(descriptor, logId).flightInfoFor(session, descriptor, logId); + try (final SafeCloseable ignored = QueryPerformanceRecorder.getInstance().getNugget( + "flightInfoForDescriptor:" + descriptor)) { + return getResolver(descriptor, logId).flightInfoFor(session, descriptor, logId); + } } /** diff --git a/server/src/main/java/io/deephaven/server/table/inputtables/InputTableServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/table/inputtables/InputTableServiceGrpcImpl.java index f2f64ef9aa5..2ef1d2e7419 100644 --- a/server/src/main/java/io/deephaven/server/table/inputtables/InputTableServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/table/inputtables/InputTableServiceGrpcImpl.java @@ -61,20 +61,12 @@ public void addTableToInputTable( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String targetName = ticketRouter.getLogNameFor(request.getInputTable(), "inputTable"); - final SessionState.ExportObject
targetTable; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTargetTableTicket:" + targetName)) { - targetTable = ticketRouter.resolve(session, request.getInputTable(), "inputTable"); - } - - final String tableToAddName = ticketRouter.getLogNameFor(request.getTableToAdd(), "tableToAdd"); - final SessionState.ExportObject
tableToAddExport; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTableToAddTicket:" + tableToAddName)) { - tableToAddExport = ticketRouter.resolve(session, request.getTableToAdd(), "tableToAdd"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
targetTable = + ticketRouter.resolve(session, request.getInputTable(), "inputTable"); + + final SessionState.ExportObject
tableToAddExport = + ticketRouter.resolve(session, request.getTableToAdd(), "tableToAdd"); session.nonExport() .queryPerformanceRecorder(queryPerformanceRecorder) @@ -126,20 +118,12 @@ public void deleteTableFromInputTable( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String targetName = ticketRouter.getLogNameFor(request.getInputTable(), "inputTable"); - final SessionState.ExportObject
targetTable; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTargetTableTicket:" + targetName)) { - targetTable = ticketRouter.resolve(session, request.getInputTable(), "inputTable"); - } - - final String tableToRemove = ticketRouter.getLogNameFor(request.getTableToRemove(), "tableToRemove"); - final SessionState.ExportObject
tableToRemoveExport; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTableToRemoveTicket:" + tableToRemove)) { - tableToRemoveExport = ticketRouter.resolve(session, request.getTableToRemove(), "tableToRemove"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
targetTable = + ticketRouter.resolve(session, request.getInputTable(), "inputTable"); + + final SessionState.ExportObject
tableToRemoveExport = + ticketRouter.resolve(session, request.getTableToRemove(), "tableToRemove"); session.nonExport() .queryPerformanceRecorder(queryPerformanceRecorder) diff --git a/server/src/main/java/io/deephaven/server/table/ops/TableServiceGrpcImpl.java b/server/src/main/java/io/deephaven/server/table/ops/TableServiceGrpcImpl.java index 592f8fbaed4..966c3b364ca 100644 --- a/server/src/main/java/io/deephaven/server/table/ops/TableServiceGrpcImpl.java +++ b/server/src/main/java/io/deephaven/server/table/ops/TableServiceGrpcImpl.java @@ -474,13 +474,9 @@ public void seekRow( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(sourceId, "sourceId"); - final SessionState.ExportObject
exportedTable; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - exportedTable = ticketRouter.resolve(session, sourceId, "sourceId"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject
exportedTable = + ticketRouter.resolve(session, sourceId, "sourceId"); session.nonExport() .queryPerformanceRecorder(queryPerformanceRecorder) @@ -635,13 +631,8 @@ public void getExportedTableCreationResponse( final QueryPerformanceRecorder queryPerformanceRecorder = QueryPerformanceRecorder.newQuery( description, QueryPerformanceNugget.DEFAULT_FACTORY); - try (final SafeCloseable ignored1 = queryPerformanceRecorder.startQuery()) { - final String ticketName = ticketRouter.getLogNameFor(request, "request"); - final SessionState.ExportObject export; - try (final SafeCloseable ignored2 = QueryPerformanceRecorder.getInstance().getNugget( - "resolveTicket:" + ticketName)) { - export = ticketRouter.resolve(session, request, "request"); - } + try (final SafeCloseable ignored = queryPerformanceRecorder.startQuery()) { + final SessionState.ExportObject export = ticketRouter.resolve(session, request, "request"); session.nonExport() .queryPerformanceRecorder(queryPerformanceRecorder) @@ -720,11 +711,7 @@ private SessionState.ExportObject
resolveOneShotReference( "One-shot operations must use ticket references"); } - final String ticketName = ticketRouter.getLogNameFor(ref.getTicket(), "TableServiceGrpcImpl"); - try (final SafeCloseable ignored = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - return ticketRouter.resolve(session, ref.getTicket(), "sourceId"); - } + return ticketRouter.resolve(session, ref.getTicket(), "sourceId"); } private SessionState.ExportObject
resolveBatchReference( @@ -733,11 +720,7 @@ private SessionState.ExportObject
resolveBatchReference( @NotNull final TableReference ref) { switch (ref.getRefCase()) { case TICKET: - final String ticketName = ticketRouter.getLogNameFor(ref.getTicket(), "TableServiceGrpcImpl"); - try (final SafeCloseable ignored = - QueryPerformanceRecorder.getInstance().getNugget("resolveTicket:" + ticketName)) { - return ticketRouter.resolve(session, ref.getTicket(), "sourceId"); - } + return ticketRouter.resolve(session, ref.getTicket(), "sourceId"); case BATCH_OFFSET: final int offset = ref.getBatchOffset(); if (offset < 0 || offset >= exportBuilders.size()) {