diff --git a/completable-reactor-runtime/src/main/kotlin/ru/fix/completable/reactor/runtime/ProfilerMetrics.kt b/completable-reactor-runtime/src/main/kotlin/ru/fix/completable/reactor/runtime/ProfilerMetrics.kt index d8eff183..d7bc7831 100644 --- a/completable-reactor-runtime/src/main/kotlin/ru/fix/completable/reactor/runtime/ProfilerMetrics.kt +++ b/completable-reactor-runtime/src/main/kotlin/ru/fix/completable/reactor/runtime/ProfilerMetrics.kt @@ -5,33 +5,33 @@ import ru.fix.aggregating.profiler.Identity object Metrics { const val PENDING_REQUEST = "pending_request" - const val REACTOR_EXECUTION = "completable_reactor" + const val COMPLETABLE_REACTOR = "completable_reactor" - const val REACTOR_VERTEX_EXECUTION = "completable_reactor_vertices" + const val COMPLETABLE_REACTOR_GRAPH = "completable_reactor_graph" } object Tags { - const val MERGE = "merge" + const val MERGER = "merger" - const val HANDLE = "handle" + const val HANDLER = "handler" - const val REACHED_TERMINAL_STEP = "payload_reached_terminal_step" + const val SUBMIT = "submit" - const val FULLY_COMPLETED = "execution_graph_fully_completed" + const val EXECUTION = "execution" } object ProfilerIdentity { fun mergeIdentity(payload: String?, vertexName: String?) = Identity( - Metrics.REACTOR_VERTEX_EXECUTION, - tags(payload, Tags.MERGE, vertexName) + Metrics.COMPLETABLE_REACTOR_GRAPH, + tags(payload, Tags.MERGER, vertexName) ) fun handlerIdentity(payload: String?, vertexName: String?) = Identity( - Metrics.REACTOR_VERTEX_EXECUTION, - tags(payload, Tags.HANDLE, vertexName) + Metrics.COMPLETABLE_REACTOR_GRAPH, + tags(payload, Tags.HANDLER, vertexName) ) private fun tags(payload: String?, operation: String, vertexName: String?) = @@ -44,20 +44,20 @@ object ProfilerIdentity { @JvmStatic fun payloadIdentity(payload: String?) = Identity( - Metrics.REACTOR_EXECUTION, - tags(payload, Tags.REACHED_TERMINAL_STEP) + Metrics.COMPLETABLE_REACTOR, + tags(payload, Tags.SUBMIT) ) @JvmStatic fun executionIdentity(payload: String?) = Identity( - Metrics.REACTOR_EXECUTION, - tags(payload, Tags.FULLY_COMPLETED) + Metrics.COMPLETABLE_REACTOR, + tags(payload, Tags.EXECUTION) ) private fun tags(payload: String?, operation: String) = mapOf( "payload" to payload, - "execution_cycle" to operation + "operation" to operation ) } \ No newline at end of file diff --git a/completable-reactor-runtime/src/test/java/ru/fix/completable/reactor/runtime/tests/ProfilingTest.java b/completable-reactor-runtime/src/test/java/ru/fix/completable/reactor/runtime/tests/ProfilingTest.java index eb4d31d2..043f833a 100644 --- a/completable-reactor-runtime/src/test/java/ru/fix/completable/reactor/runtime/tests/ProfilingTest.java +++ b/completable-reactor-runtime/src/test/java/ru/fix/completable/reactor/runtime/tests/ProfilingTest.java @@ -74,8 +74,6 @@ static class SimpleGraph extends Graph { } - - @Test public void trace_payload_if_payload_contain_special_id() throws Exception { @@ -108,14 +106,14 @@ public void trace_payload_if_payload_contain_special_id() throws Exception { assertEquals(80, identities.size()); List expected = new ArrayList<>(); - expected.addAll(vertexIdentities(Tags.HANDLE, "processor1", 10)); - expected.addAll(vertexIdentities(Tags.HANDLE,"processor2", 10)); - expected.addAll(vertexIdentities(Tags.HANDLE,"processor3", 10)); - expected.addAll(vertexIdentities(Tags.MERGE, "processor1", 10)); - expected.addAll(vertexIdentities(Tags.MERGE,"processor2", 10)); - expected.addAll(vertexIdentities(Tags.MERGE,"processor3", 10)); - expected.addAll(executionIdentity(Tags.REACHED_TERMINAL_STEP, 10)); - expected.addAll(executionIdentity(Tags.FULLY_COMPLETED, 10)); + expected.addAll(vertexIdentities(Tags.HANDLER, "processor1", 10)); + expected.addAll(vertexIdentities(Tags.HANDLER,"processor2", 10)); + expected.addAll(vertexIdentities(Tags.HANDLER,"processor3", 10)); + expected.addAll(vertexIdentities(Tags.MERGER, "processor1", 10)); + expected.addAll(vertexIdentities(Tags.MERGER,"processor2", 10)); + expected.addAll(vertexIdentities(Tags.MERGER,"processor3", 10)); + expected.addAll(executionIdentity(Tags.SUBMIT, 10)); + expected.addAll(executionIdentity(Tags.EXECUTION, 10)); assertThat(identities, containsInAnyOrder(expected.toArray())); } @@ -127,7 +125,7 @@ private static List vertexIdentities(String operation, String vertex, tags.put("payload", TracablePayload.class.getName()); tags.put("operation", operation); tags.put("vertex", vertex); - return new Identity(Metrics.REACTOR_VERTEX_EXECUTION, tags); + return new Identity(Metrics.COMPLETABLE_REACTOR_GRAPH, tags); }) .collect(Collectors.toList()); } @@ -137,8 +135,8 @@ private static List executionIdentity(String operation, int number) { .mapToObj(i -> { Map tags = new HashMap<>(); tags.put("payload", TracablePayload.class.getName()); - tags.put("execution_cycle", operation); - return new Identity(Metrics.REACTOR_EXECUTION, tags); + tags.put("operation", operation); + return new Identity(Metrics.COMPLETABLE_REACTOR, tags); }) .collect(Collectors.toList()); }