It seems you are mixing MicroProfile Metrics and Micrometer.

For using MicroProfile Metrics, you can find an example at:

https://github.com/astefanutti/camel-k-example-metrics/blob/master/Metrics.java#L44

Note that the extra //camel-k: dependency are probably not required, so I'd 
suggest you remove them.

Last but not least, in order to understand why the build fails, could you 
please provide the operator Pod logs?

> On 26 Nov 2021, at 19:27, Roberto Camelk <betonetotbo.cam...@gmail.com> wrote:
> 
> Hi, I'm trying to create a sample um route using microprofile metrics.
> 
> So I created this java source file containing:
> 
> //camel-k: dependency=camel-cron
> //camel-k: dependency=camel-quarkus-microprofile-metrics
> 
> public class LoggedInRoute extends RouteBuilder {
> 
>    @Override
>    public void configure() throws Exception {
>        var seconds =
> java.util.concurrent.ThreadLocalRandom.current().nextInt(1, 10);
>        from("cron:tab?schedule=0/5+*+*+*+*+?")
>                .to("micrometer:timer:simpleTimerMock?action=start")
>                .delay(seconds * 1000)
>                .setBody(simple("{\"msg\":\"Seconds: " + seconds + "\"}"))
>                .log("${body}")
>                .to("micrometer:timer:simpleTimerMock?action=stop");
>    }
> 
> }
> 
> To run it, I used this command:
> 
> kamel run test/Micrometer.java --dev
> 
> But camel-k CLI fails with this log:
> 
> Modeline options have been loaded from source files
> Full command: kamel run test/Micrometer.java --dev
> --dependency=camel-cron
> --dependency=camel-quarkus-microprofile-metrics
> Integration "micrometer" created
> Progress: integration "micrometer" in phase Initialization
> Condition "IntegrationPlatformAvailable" is "True" for Integration
> micrometer: platform/camel-k
> Integration "micrometer" in phase "Initialization"
> Progress: integration "micrometer" in phase Building Kit
> Integration "micrometer" in phase "Building Kit"
> Condition "IntegrationKitAvailable" is "False" for Integration
> micrometer: creating a new integration kit
> Integration Kit "kit-c6gi8msurk73bvs3vdu0", created by Integration
> "micrometer", changed phase to "Build Submitted"
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Scheduling"
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Pending"
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Running"
> Integration Kit "kit-c6gi8msurk73bvs3vdu0", created by Integration
> "micrometer", changed phase to "Build Running"
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Failed"
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Initialization" (recovery 1 of 5)
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Scheduling" (recovery 1 of 5)
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Pending" (recovery 1 of 5)
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Running" (recovery 1 of 5)
> Build "kit-c6gi8msurk73bvs3vdu0", created by Integration "micrometer",
> changed phase to "Failed" (recovery 1 of 5)
> (combined from similar events): Build "kit-c6gi8msurk73bvs3vdu0",
> created by Integration "micrometer", changed phase to "Initialization"
> (recovery 2 of 5)
> (combined from similar events): Build "kit-c6gi8msurk73bvs3vdu0",
> created by Integration "micrometer", changed phase to "Scheduling"
> (recovery 2 of 5)
> (combined from similar events): Build "kit-c6gi8msurk73bvs3vdu0",
> created by Integration "micrometer", changed phase to "Pending"
> (recovery 2 of 5)
> (combined from similar events): Build "kit-c6gi8msurk73bvs3vdu0",
> created by Integration "micrometer", changed phase to "Running"
> (recovery 2 of 5)
> ...

Reply via email to