From 48ef80846338d93d6732310e2da42cbc96ad8548 Mon Sep 17 00:00:00 2001 From: Atharva Sharma Date: Tue, 23 Apr 2024 01:24:29 +0530 Subject: [PATCH] functional model init Signed-off-by: Atharva Sharma --- .../opensearch/transport/Netty4ModulePlugin.java | 5 +++-- .../transport/nio/NioTransportPlugin.java | 5 +++-- .../opensearch/common/network/NetworkModule.java | 5 ++++- server/src/main/java/org/opensearch/node/Node.java | 1 + .../java/org/opensearch/plugins/NetworkPlugin.java | 5 +++-- .../common/network/NetworkModuleTests.java | 13 +++++++------ .../transport/nio/MockNioTransportPlugin.java | 5 +++-- 7 files changed, 24 insertions(+), 15 deletions(-) diff --git a/modules/transport-netty4/src/main/java/org/opensearch/transport/Netty4ModulePlugin.java b/modules/transport-netty4/src/main/java/org/opensearch/transport/Netty4ModulePlugin.java index e2c84ab5d339a..769b127c1bac6 100644 --- a/modules/transport-netty4/src/main/java/org/opensearch/transport/Netty4ModulePlugin.java +++ b/modules/transport-netty4/src/main/java/org/opensearch/transport/Netty4ModulePlugin.java @@ -51,6 +51,7 @@ import org.opensearch.plugins.Plugin; import org.opensearch.plugins.SecureHttpTransportSettingsProvider; import org.opensearch.plugins.SecureTransportSettingsProvider; +import org.opensearch.telemetry.metrics.MetricsRegistry; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.netty4.Netty4Transport; @@ -103,8 +104,8 @@ public Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.singletonMap( NETTY_TRANSPORT_NAME, () -> new Netty4Transport( diff --git a/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/NioTransportPlugin.java b/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/NioTransportPlugin.java index d4be876867651..5eeda34279f4d 100644 --- a/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/NioTransportPlugin.java +++ b/plugins/transport-nio/src/main/java/org/opensearch/transport/nio/NioTransportPlugin.java @@ -50,6 +50,7 @@ import org.opensearch.http.nio.NioHttpServerTransport; import org.opensearch.plugins.NetworkPlugin; import org.opensearch.plugins.Plugin; +import org.opensearch.telemetry.metrics.MetricsRegistry; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.Transport; @@ -92,8 +93,8 @@ public Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.singletonMap( NIO_TRANSPORT_NAME, () -> new NioTransport( diff --git a/server/src/main/java/org/opensearch/common/network/NetworkModule.java b/server/src/main/java/org/opensearch/common/network/NetworkModule.java index bb8da190a6f35..fa291a09c98f4 100644 --- a/server/src/main/java/org/opensearch/common/network/NetworkModule.java +++ b/server/src/main/java/org/opensearch/common/network/NetworkModule.java @@ -61,6 +61,7 @@ import org.opensearch.ratelimitting.admissioncontrol.enums.AdmissionControlActionType; import org.opensearch.tasks.RawTaskStatus; import org.opensearch.tasks.Task; +import org.opensearch.telemetry.metrics.MetricsRegistry; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.Transport; @@ -176,6 +177,7 @@ public NetworkModule( HttpServerTransport.Dispatcher dispatcher, ClusterSettings clusterSettings, Tracer tracer, + MetricsRegistry metricsRegistry, List transportInterceptors, Collection secureSettingsFactories ) { @@ -229,7 +231,8 @@ public NetworkModule( circuitBreakerService, namedWriteableRegistry, networkService, - tracer + tracer, + metricsRegistry ); for (Map.Entry> entry : transportFactory.entrySet()) { registerTransport(entry.getKey(), entry.getValue()); diff --git a/server/src/main/java/org/opensearch/node/Node.java b/server/src/main/java/org/opensearch/node/Node.java index 7fa2b6c8ff497..ffa790cf3ad17 100644 --- a/server/src/main/java/org/opensearch/node/Node.java +++ b/server/src/main/java/org/opensearch/node/Node.java @@ -971,6 +971,7 @@ protected Node( restController, clusterService.getClusterSettings(), tracer, + metricsRegistry, transportInterceptors, secureSettingsFactories ); diff --git a/server/src/main/java/org/opensearch/plugins/NetworkPlugin.java b/server/src/main/java/org/opensearch/plugins/NetworkPlugin.java index 138ef6f71280d..b2abbd709cfb1 100644 --- a/server/src/main/java/org/opensearch/plugins/NetworkPlugin.java +++ b/server/src/main/java/org/opensearch/plugins/NetworkPlugin.java @@ -41,6 +41,7 @@ import org.opensearch.core.indices.breaker.CircuitBreakerService; import org.opensearch.core.xcontent.NamedXContentRegistry; import org.opensearch.http.HttpServerTransport; +import org.opensearch.telemetry.metrics.MetricsRegistry; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.Transport; @@ -84,8 +85,8 @@ default Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.emptyMap(); } diff --git a/server/src/test/java/org/opensearch/common/network/NetworkModuleTests.java b/server/src/test/java/org/opensearch/common/network/NetworkModuleTests.java index 447377e372e61..a29791cfd3250 100644 --- a/server/src/test/java/org/opensearch/common/network/NetworkModuleTests.java +++ b/server/src/test/java/org/opensearch/common/network/NetworkModuleTests.java @@ -51,6 +51,7 @@ import org.opensearch.plugins.SecureSettingsFactory; import org.opensearch.plugins.SecureTransportSettingsProvider; import org.opensearch.plugins.TransportExceptionHandler; +import org.opensearch.telemetry.metrics.MetricsRegistry; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.telemetry.tracing.noop.NoopTracer; import org.opensearch.test.OpenSearchTestCase; @@ -177,8 +178,8 @@ public Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.singletonMap("custom", custom); } }; @@ -286,8 +287,8 @@ public Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.singletonMap("default_custom", customTransport); } @@ -331,8 +332,8 @@ public Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.singletonMap("default_custom", customTransport); } diff --git a/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransportPlugin.java b/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransportPlugin.java index deb489614be26..1b7006c6e5e88 100644 --- a/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransportPlugin.java +++ b/test/framework/src/main/java/org/opensearch/transport/nio/MockNioTransportPlugin.java @@ -39,6 +39,7 @@ import org.opensearch.core.indices.breaker.CircuitBreakerService; import org.opensearch.plugins.NetworkPlugin; import org.opensearch.plugins.Plugin; +import org.opensearch.telemetry.metrics.MetricsRegistry; import org.opensearch.telemetry.tracing.Tracer; import org.opensearch.threadpool.ThreadPool; import org.opensearch.transport.Transport; @@ -59,8 +60,8 @@ public Map> getTransports( CircuitBreakerService circuitBreakerService, NamedWriteableRegistry namedWriteableRegistry, NetworkService networkService, - Tracer tracer - ) { + Tracer tracer, + MetricsRegistry metricsRegistry) { return Collections.singletonMap( MOCK_NIO_TRANSPORT_NAME, () -> new MockNioTransport(