File tree Expand file tree Collapse file tree 3 files changed +4
-4
lines changed
main/java/io/getunleash/metric
test/java/io/getunleash/event Expand file tree Collapse file tree 3 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -12,14 +12,14 @@ public class ClientMetrics implements UnleashEvent {
1212 private final String appName ;
1313 private final String instanceId ;
1414 private final String connectionId ;
15- private final MetricsBucket bucket ;
15+ @ Nullable private final MetricsBucket bucket ;
1616 private final String environment ;
1717 private final String specVersion ;
1818 @ Nullable private final String platformName ;
1919 @ Nullable private final String platformVersion ;
2020 @ Nullable private final String yggdrasilVersion ;
2121
22- ClientMetrics (UnleashConfig config , MetricsBucket bucket ) {
22+ ClientMetrics (UnleashConfig config , @ Nullable MetricsBucket bucket ) {
2323 this .environment = config .getEnvironment ();
2424 this .appName = config .getAppName ();
2525 this .instanceId = config .getInstanceId ();
@@ -43,6 +43,7 @@ public String getConnectionId() {
4343 return connectionId ;
4444 }
4545
46+ @ Nullable
4647 public MetricsBucket getBucket () {
4748 return bucket ;
4849 }
Original file line number Diff line number Diff line change @@ -56,7 +56,7 @@ public int registerClient(ClientRegistration registration) {
5656 }
5757
5858 public int sendMetrics (ClientMetrics metrics ) {
59- if (!unleashConfig .isDisableMetrics ()) {
59+ if (!unleashConfig .isDisableMetrics () && metrics . getBucket () != null ) {
6060 try {
6161 int statusCode = post (clientMetricsURL , metrics );
6262 eventDispatcher .dispatch (metrics );
Original file line number Diff line number Diff line change @@ -78,7 +78,6 @@ void subscribersAreNotified() {
7878 assertThat (testSubscriber .events )
7979 .filteredOn (e -> e instanceof ClientRegistration )
8080 .hasSize (1 );
81- assertThat (testSubscriber .events ).filteredOn (e -> e instanceof ClientMetrics ).hasSize (1 );
8281 }
8382
8483 private class TestSubscriber implements UnleashSubscriber {
You can’t perform that action at this time.
0 commit comments