@Beta
    public static Application fromBuilder(Builder builder) throws Exception {
        return builder.build();
    }
@Test
    void application_generation_metric() throws Exception {
        try (ApplicationFacade app = new ApplicationFacade(Application.fromBuilder(new Application.Builder().container("default", new Application.Builder.Container()
                                                                                                                                          .component(ComponentWithMetrics.class))))) {
            var component = (ComponentWithMetrics)app.getComponentById(ComponentWithMetrics.class.getName());
            assertNotNull(component);
            var metrics = (SimpleMetricConsumer)component.metrics().newInstance(); // not actually a new instance
            assertNotNull(metrics);
            int maxWaitMs = 10000;
            Bucket snapshot = null;
            while (maxWaitMs-- > 0 && ( snapshot = metrics.receiver().getSnapshot() ) == null) {
                Thread.sleep(1);
            }
            assertNotNull(snapshot);
            assertEquals(1, snapshot.getValuesForMetric("application_generation").size());
            assertEquals(0, snapshot.getValuesForMetric("application_generation").iterator().next().getValue().getLast());
        }
    }