Changing metrics channel name to align with boot
This commit is contained in:
committed by
Ilayaperumal Gopinathan
parent
07d0328d68
commit
7438fde088
@@ -1828,7 +1828,7 @@ This module allow operators to collect metrics from stream applications without
|
||||
|
||||
HTTP polling can be challenging on cloud environments since applications could be on a private network or behind a Load balancer that prevents per instance access.
|
||||
|
||||
The module is activated when you set the destination name for its channel, `spring.cloud.stream.bindings.streamMetrics.destination=<DESTINATION_NAME>`.
|
||||
The module is activated when you set the destination name for its channel, `spring.cloud.stream.bindings.aggregateMetricsChannel.destination=<DESTINATION_NAME>`.
|
||||
|
||||
By default the module is configured to only send Spring Integration message channel metrics.
|
||||
|
||||
@@ -1864,7 +1864,7 @@ properties::
|
||||
+
|
||||
Default: null.
|
||||
+
|
||||
spring.cloud.stream.bindings.streamMetrics.contentType::
|
||||
spring.cloud.stream.bindings.aggregateMetricsChannel.contentType::
|
||||
Content-Type of the message
|
||||
+
|
||||
Default: `application/json`
|
||||
|
||||
@@ -32,7 +32,7 @@ public class BinderMetricsEnvironmentPostProcessor implements EnvironmentPostPro
|
||||
public void postProcessEnvironment(ConfigurableEnvironment environment,
|
||||
SpringApplication application) {
|
||||
Map<String, Object> propertiesToAdd = new HashMap<>();
|
||||
propertiesToAdd.put("spring.cloud.stream.bindings.streamMetrics.contentType",
|
||||
propertiesToAdd.put("spring.cloud.stream.bindings."+Emitter.METRICS_CHANNEL_NAME+".contentType",
|
||||
"application/json");
|
||||
propertiesToAdd.put("spring.cloud.stream.metrics.instanceIndex",
|
||||
"${spring.cloud.stream.instanceIndex:${INSTANCE_INDEX:${CF_INSTANCE_INDEX:0}}}");
|
||||
|
||||
@@ -24,7 +24,7 @@ import org.springframework.messaging.MessageChannel;
|
||||
*/
|
||||
public interface Emitter {
|
||||
|
||||
String METRICS_CHANNEL_NAME = "streamMetrics";
|
||||
String METRICS_CHANNEL_NAME = "aggregateMetricsChannel";
|
||||
|
||||
@Output(METRICS_CHANNEL_NAME)
|
||||
MessageChannel metrics();
|
||||
|
||||
@@ -73,7 +73,7 @@ public class ApplicationMetricsExporterTests {
|
||||
ConfigurableApplicationContext applicationContext = SpringApplication.run(
|
||||
BinderExporterApplication.class, "--server.port=0",
|
||||
"--spring.jmx.enabled=false", "--spring.metrics.export.delay-millis=500",
|
||||
"--spring.cloud.stream.bindings.streamMetrics.destination=foo");
|
||||
"--spring.cloud.stream.bindings.aggregateMetricsChannel.destination=foo");
|
||||
Emitter emitterSource = applicationContext.getBean(Emitter.class);
|
||||
MessageCollector collector = applicationContext.getBean(MessageCollector.class);
|
||||
Message<?> message = collector.forChannel(emitterSource.metrics()).poll(1000,
|
||||
@@ -97,7 +97,7 @@ public class ApplicationMetricsExporterTests {
|
||||
BinderExporterApplication.class, "--server.port=0",
|
||||
"--spring.jmx.enabled=false", "--spring.metrics.export.delay-millis=500",
|
||||
"--spring.application.name=foo", "--spring.cloud.stream.instanceIndex=1",
|
||||
"--spring.cloud.stream.bindings.streamMetrics.destination=foo");
|
||||
"--spring.cloud.stream.bindings.aggregateMetricsChannel.destination=foo");
|
||||
Emitter emitterSource = applicationContext.getBean(Emitter.class);
|
||||
MessageCollector collector = applicationContext.getBean(MessageCollector.class);
|
||||
Message<?> message = collector.forChannel(emitterSource.metrics()).poll(1000,
|
||||
@@ -122,7 +122,7 @@ public class ApplicationMetricsExporterTests {
|
||||
"--spring.jmx.enabled=false", "--spring.metrics.export.delay-millis=500",
|
||||
"--spring.cloud.stream.metrics.prefix=foo",
|
||||
"--spring.cloud.stream.instanceIndex=1",
|
||||
"--spring.cloud.stream.bindings.streamMetrics.destination=foo");
|
||||
"--spring.cloud.stream.bindings.aggregateMetricsChannel.destination=foo");
|
||||
Emitter emitterSource = applicationContext.getBean(Emitter.class);
|
||||
MessageCollector collector = applicationContext.getBean(MessageCollector.class);
|
||||
Message<?> message = collector.forChannel(emitterSource.metrics()).poll(1000,
|
||||
@@ -145,7 +145,7 @@ public class ApplicationMetricsExporterTests {
|
||||
ConfigurableApplicationContext applicationContext = SpringApplication.run(
|
||||
BinderExporterApplication.class, "--server.port=0",
|
||||
"--spring.jmx.enabled=false", "--spring.metrics.export.delay-millis=500",
|
||||
"--spring.cloud.stream.bindings.streamMetrics.destination=foo",
|
||||
"--spring.cloud.stream.bindings.aggregateMetricsChannel.destination=foo",
|
||||
"--spring.metrics.export.includes=mem**",
|
||||
"--spring.metrics.export.excludes=integration**");
|
||||
Emitter emitterSource = applicationContext.getBean(Emitter.class);
|
||||
@@ -168,7 +168,7 @@ public class ApplicationMetricsExporterTests {
|
||||
ConfigurableApplicationContext applicationContext = SpringApplication.run(
|
||||
BinderExporterApplication.class, "--server.port=0",
|
||||
"--spring.jmx.enabled=false", "--spring.metrics.export.delay-millis=500",
|
||||
"--spring.cloud.stream.bindings.streamMetrics.destination=foo",
|
||||
"--spring.cloud.stream.bindings.aggregateMetricsChannel.destination=foo",
|
||||
"--spring.metrics.export.includes=integration**",
|
||||
"--spring.cloud.stream.metrics.properties=java**,spring.test.env**");
|
||||
Emitter emitterSource = applicationContext.getBean(Emitter.class);
|
||||
@@ -194,7 +194,7 @@ public class ApplicationMetricsExporterTests {
|
||||
BinderExporterApplication.class, "--server.port=0",
|
||||
"--spring.jmx.enabled=false", "--spring.metrics.export.delay-millis=500",
|
||||
"--spring.application.name=foo", "--spring.cloud.stream.instanceIndex=1",
|
||||
"--spring.cloud.stream.bindings.streamMetrics.destination=foo",
|
||||
"--spring.cloud.stream.bindings.aggregateMetricsChannel.destination=foo",
|
||||
"--spring.cloud.stream.metrics.key=foobarfoo");
|
||||
Emitter emitterSource = applicationContext.getBean(Emitter.class);
|
||||
MessageCollector collector = applicationContext.getBean(MessageCollector.class);
|
||||
|
||||
Reference in New Issue
Block a user