ClusterIdDimensionProcessor implements MetricsProcessor { @Override public void process(MetricsPacket.Builder builder) { String clusterType = emptyIfNull(builder.getDimensionValue(toDimensionId(INTERNAL_CLUSTER_TYPE))); String clusterId = emptyIfNull(builder.getDimensionValue(toDimensionId(INTERNAL_CLUSTER_ID))); String newClusterId; if (! clusterType.isEmpty() && ! clusterId.isEmpty()) newClusterId = clusterType + "/" + clusterId; else if (! clusterType.isEmpty()) newClusterId = clusterType; else if (! clusterId.isEmpty()) newClusterId = clusterId; else return; builder.putDimension(toDimensionId(CLUSTER_ID), newClusterId); }  @Override void process(MetricsPacket.Builder builder);  }
@Test public void cluster_id_is_not_added_when_both_type_and_id_are_null() { var builder = new MetricsPacket.Builder(toServiceId("foo")); var processor = new ClusterIdDimensionProcessor(); processor.process(builder); assertFalse(builder.getDimensionIds().contains(NEW_ID_DIMENSION)); }