ServiceIdDimensionProcessor implements MetricsProcessor { @Override public void process(MetricsPacket.Builder builder) { String serviceIdValue = builder.getDimensionValue(toDimensionId(INTERNAL_SERVICE_ID)); if (serviceIdValue != null) builder.putDimension(toDimensionId(SERVICE_ID), serviceIdValue); }  @Override void process(MetricsPacket.Builder builder);  }
@Test public void new_service_id_is_added_when_internal_service_id_exists() { var builder = new MetricsPacket.Builder(toServiceId("foo")); builder.putDimension(toDimensionId(INTERNAL_SERVICE_ID), "service"); var processor = new ServiceIdDimensionProcessor(); processor.process(builder); assertTrue(builder.getDimensionIds().contains(NEW_ID_DIMENSION)); assertEquals("service", builder.getDimensionValue(NEW_ID_DIMENSION)); }
@Test public void new_service_id_is_not_added_when_internal_service_id_is_null() { var builder = new MetricsPacket.Builder(toServiceId("foo")); var processor = new ServiceIdDimensionProcessor(); processor.process(builder); assertFalse(builder.getDimensionIds().contains(NEW_ID_DIMENSION)); }