You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@camel.apache.org by CASAUX Nicolas <ni...@soprasteria.com> on 2020/09/24 13:03:25 UTC

Camel Opentracing and incorrect HTTP method

Hello, !

Trying to play with Camel 3.5.0 and Opentracing on Springboot, with Elastic APM, with this simple route:

from("timer:hello?repeatCount=1&delay=1000").routeId("init")
        .setBody(constant(null))
        .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.POST))
        .setHeader(Exchange.HTTP_URI,constant("http://localhost:3000/answer"))
        .to("log:before call 1")
        .to("http://dummy")
        .setBody(constant("dummyBody"))
        .setHeader(Exchange.HTTP_METHOD, constant(HttpMethods.GET))
        .setHeader(Exchange.HTTP_URI,constant("http://localhost:3000/answer"))
        .to("log:before call 2")
        .to("http://dummy")
        ;

In this route, I first make a "POST" request, then a "GET" request.
I works fine as per my mock logs:

2020-09-24 14:55:52.789  INFO 104320 --- [           main] o.a.c.i.e.InternalRouteStartupManager    : Route: init started and consuming from: timer://hello
2020-09-24 14:55:52.795  INFO 104320 --- [           main] o.a.c.impl.engine.AbstractCamelContext   : Total 1 routes, of which 1 are started
2020-09-24 14:55:52.795  INFO 104320 --- [           main] o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1) started in 0.106 seconds
2020-09-24 14:55:52.802  INFO 104320 --- [           main] com.example.demo.DemoApplication         : Started DemoApplication in 2.239 seconds (JVM running for 10.848)
2020-09-24 14:55:53.920  INFO 104320 --- [- timer://hello] before call 1                            : Exchange[ExchangePattern: InOnly, BodyType: null, Body: [Body is null]]
2020-09-24 14:55:54.071  INFO 104320 --- [- timer://hello] before call 2                            : Exchange[ExchangePattern: InOnly, BodyType: String, Body: dummyBody]

The mock logs confirms this, as we can see in the timestamps:

[cid:image001.png@01D69283.29BEA7A0]

However, in the APM logs of Kibana, I see this:

[cid:image002.png@01D69283.D9A74F00]
The HTTP operation are incorrect.
It seems (?) that the operation are based on the fact that the Exchange body is null or not. Is that the expected behavior ?

Thanks!

RE: Camel Opentracing and incorrect HTTP method

Posted by CASAUX Nicolas <ni...@soprasteria.com>.
Hi Claus,

You are right, I tested with:

        from("timer:hello?repeatCount=1&delay=1000").routeId("init")
                .setBody(constant(null))
                .setHeader(Exchange.HTTP_METHOD, constant("POST"))
                .setHeader(Exchange.HTTP_URI,constant("http://localhost:3000/answer"))
                .to("log:before call 1")
                .to("http://dummy")
                .setBody(constant("dummyBody"))
                .setHeader(Exchange.HTTP_METHOD, constant("GET"))
                .setHeader(Exchange.HTTP_URI,constant("http://localhost:3000/answer"))
                .to("log:before call 2")
                .to("http://dummy")
                ;

And now the span have the correct http method.

I will open a Jira. Thanks for your help! :)


-----Message d'origine-----
De : Claus Ibsen <cl...@gmail.com> 
Envoyé : jeudi 24 septembre 2020 16:40
À : users@camel.apache.org
Objet : Re: Camel Opentracing and incorrect HTTP method

Hi

Ah I can see the little bug

https://github.com/apache/camel/blob/master/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/AbstractHttpSpanDecorator.java#L33

This one checks only if its a string type, but you use a constant or enum etc.

You are welcome to create a JIRA ticket so we wont forget and can get it fixed.
Basically you just get it as a string via type converter

exchange.getIn().getHeader("CamelHttpMethod", String.class);

which should kick in the type converter so the enum is converted to its string value and therefore GET or POST etc.

On Thu, Sep 24, 2020 at 4:25 PM Claus Ibsen <cl...@gmail.com> wrote:
>
> Hi
>
> Ah yeah so there is a idiom that Camel selects either GET or POST 
> depending on whether the body is null or not.
> But since you have an explicit header with the http operation to use, 
> then that ought to take presence.
>
> So the span may report something different than what http actually was 
> using. You can maybe check the HTTP logs or the logs from camel-http 
> if you turn on DEBUG/TRACE logging to see what it used actually.
>
> On Thu, Sep 24, 2020 at 4:16 PM CASAUX Nicolas 
> <ni...@soprasteria.com> wrote:
> >
> > Hello Claus,
> >
> > Sorry I thought I could send screenshots...
> >
> > Actually both spans have the wrong http method:
> >
> > First span (of the actual POST):
> >
> >     "@timestamp": "2020-09-24T12:55:53.923Z",
> >     "ecs": {
> >       "version": "1.5.0"
> >     },
> >     "service": {
> >       "name": "DemoApplication"
> >     },
> >     "processor": {
> >       "name": "transaction",
> >       "event": "span"
> >     },
> >     "transaction": {
> >       "id": "1db11aa7eaf9f1f1"
> >     },
> >     "labels": {
> >       "component": "camel-http",
> >       "http_method": "GET",
> >       "http_status_code": 200,
> >       "camel_uri": "http://dummy",
> >       "http_url": "http://localhost:3000/answer"
> >     }
> >
> > Second span (of the actual GET):
> >
> >     "@timestamp": "2020-09-24T12:55:54.071Z",
> >     "ecs": {
> >       "version": "1.5.0"
> >     },
> >     "service": {
> >       "name": "DemoApplication"
> >     },
> >     "processor": {
> >       "name": "transaction",
> >       "event": "span"
> >     },
> >     "transaction": {
> >       "id": "1db11aa7eaf9f1f1"
> >     },
> >     "labels": {
> >       "component": "camel-http",
> >       "http_method": "POST",
> >       "http_status_code": 200,
> >       "camel_uri": "http://dummy",
> >       "http_url": "http://localhost:3000/answer"
> >     },
> >
> > That made me think that the "http_method" in the span is maybe determined on the exchange body (null or not null) ?
> >
> >
> > -----Message d'origine-----
> > De : Claus Ibsen <cl...@gmail.com> Envoyé : jeudi 24 septembre 
> > 2020 16:04 À : users@camel.apache.org Objet : Re: Camel Opentracing 
> > and incorrect HTTP method
> >
> > Hi
> >
> > We cannot see your screenshots.
> >
> > Are you saying that in kibana that one trace is wrong and that its potential because the body is null, and that the other trace is ok ?
> >
> > On Thu, Sep 24, 2020 at 3:03 PM CASAUX Nicolas < nicolas.casaux@soprasteria.com> wrote:
> >
> > > Hello, !
> > >
> > >
> > >
> > > Trying to play with Camel 3.5.0 and Opentracing on Springboot, 
> > > with Elastic APM, with this simple route:
> > >
> > >
> > >
> > > from("timer:hello?repeatCount=1&delay=1000").routeId("init")
> > >         .setBody(constant(null))
> > >         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*POST*))
> > >         .setHeader(Exchange.*HTTP_URI*,constant("
> > > http://localhost:3000/answer"))
> > >         .to("log:before call 1")
> > >         .to("http://dummy")
> > >         .setBody(constant("dummyBody"))
> > >         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*GET*))
> > >         .setHeader(Exchange.*HTTP_URI*,constant("
> > > http://localhost:3000/answer"))
> > >         .to("log:before call 2")
> > >         .to("http://dummy")
> > >         ;
> > >
> > >
> > >
> > > In this route, I first make a “POST” request, then a “GET” request.
> > >
> > > I works fine as per my mock logs:
> > >
> > >
> > >
> > > 2020-09-24 14:55:52.789  INFO 104320 --- [           main]
> > > o.a.c.i.e.InternalRouteStartupManager    : Route: init started and
> > > consuming from: timer://hello
> > >
> > > 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> > > o.a.c.impl.engine.AbstractCamelContext   : Total 1 routes, of which 1 are
> > > started
> > >
> > > 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> > > o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> > > started in 0.106 seconds
> > >
> > > 2020-09-24 14:55:52.802  INFO 104320 --- [           main]
> > > com.example.demo.DemoApplication         : Started DemoApplication in 2.239
> > > seconds (JVM running for 10.848)
> > >
> > > 2020-09-24 14:55:53.920  INFO 104320 --- [- timer://hello] before call
> > > 1                            : Exchange[ExchangePattern: InOnly, BodyType:
> > > null, Body: [Body is null]]
> > >
> > > 2020-09-24 14:55:54.071  INFO 104320 --- [- timer://hello] before call
> > > 2                            : Exchange[ExchangePattern: InOnly, BodyType:
> > > String, Body: dummyBody]
> > >
> > >
> > >
> > > The mock logs confirms this, as we can see in the timestamps:
> > >
> > >
> > >
> > >
> > >
> > > However, in the APM logs of Kibana, I see this:
> > >
> > >
> > >
> > > The HTTP operation are incorrect.
> > >
> > > It seems (?) that the operation are based on the fact that the 
> > > Exchange body is null or not. Is that the expected behavior ?
> > >
> > >
> > >
> > > Thanks!
> > >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Camel Opentracing and incorrect HTTP method

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah I can see the little bug

https://github.com/apache/camel/blob/master/components/camel-tracing/src/main/java/org/apache/camel/tracing/decorators/AbstractHttpSpanDecorator.java#L33

This one checks only if its a string type, but you use a constant or enum etc.

You are welcome to create a JIRA ticket so we wont forget and can get it fixed.
Basically you just get it as a string via type converter

exchange.getIn().getHeader("CamelHttpMethod", String.class);

which should kick in the type converter so the enum is converted to
its string value and therefore GET or POST etc.

On Thu, Sep 24, 2020 at 4:25 PM Claus Ibsen <cl...@gmail.com> wrote:
>
> Hi
>
> Ah yeah so there is a idiom that Camel selects either GET or POST
> depending on whether the body is null or not.
> But since you have an explicit header with the http operation to use,
> then that ought to take presence.
>
> So the span may report something different than what http actually was
> using. You can maybe check the HTTP logs or the logs from camel-http
> if you turn on DEBUG/TRACE logging to see what it used actually.
>
> On Thu, Sep 24, 2020 at 4:16 PM CASAUX Nicolas
> <ni...@soprasteria.com> wrote:
> >
> > Hello Claus,
> >
> > Sorry I thought I could send screenshots...
> >
> > Actually both spans have the wrong http method:
> >
> > First span (of the actual POST):
> >
> >     "@timestamp": "2020-09-24T12:55:53.923Z",
> >     "ecs": {
> >       "version": "1.5.0"
> >     },
> >     "service": {
> >       "name": "DemoApplication"
> >     },
> >     "processor": {
> >       "name": "transaction",
> >       "event": "span"
> >     },
> >     "transaction": {
> >       "id": "1db11aa7eaf9f1f1"
> >     },
> >     "labels": {
> >       "component": "camel-http",
> >       "http_method": "GET",
> >       "http_status_code": 200,
> >       "camel_uri": "http://dummy",
> >       "http_url": "http://localhost:3000/answer"
> >     }
> >
> > Second span (of the actual GET):
> >
> >     "@timestamp": "2020-09-24T12:55:54.071Z",
> >     "ecs": {
> >       "version": "1.5.0"
> >     },
> >     "service": {
> >       "name": "DemoApplication"
> >     },
> >     "processor": {
> >       "name": "transaction",
> >       "event": "span"
> >     },
> >     "transaction": {
> >       "id": "1db11aa7eaf9f1f1"
> >     },
> >     "labels": {
> >       "component": "camel-http",
> >       "http_method": "POST",
> >       "http_status_code": 200,
> >       "camel_uri": "http://dummy",
> >       "http_url": "http://localhost:3000/answer"
> >     },
> >
> > That made me think that the "http_method" in the span is maybe determined on the exchange body (null or not null) ?
> >
> >
> > -----Message d'origine-----
> > De : Claus Ibsen <cl...@gmail.com>
> > Envoyé : jeudi 24 septembre 2020 16:04
> > À : users@camel.apache.org
> > Objet : Re: Camel Opentracing and incorrect HTTP method
> >
> > Hi
> >
> > We cannot see your screenshots.
> >
> > Are you saying that in kibana that one trace is wrong and that its potential because the body is null, and that the other trace is ok ?
> >
> > On Thu, Sep 24, 2020 at 3:03 PM CASAUX Nicolas < nicolas.casaux@soprasteria.com> wrote:
> >
> > > Hello, !
> > >
> > >
> > >
> > > Trying to play with Camel 3.5.0 and Opentracing on Springboot, with
> > > Elastic APM, with this simple route:
> > >
> > >
> > >
> > > from("timer:hello?repeatCount=1&delay=1000").routeId("init")
> > >         .setBody(constant(null))
> > >         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*POST*))
> > >         .setHeader(Exchange.*HTTP_URI*,constant("
> > > http://localhost:3000/answer"))
> > >         .to("log:before call 1")
> > >         .to("http://dummy")
> > >         .setBody(constant("dummyBody"))
> > >         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*GET*))
> > >         .setHeader(Exchange.*HTTP_URI*,constant("
> > > http://localhost:3000/answer"))
> > >         .to("log:before call 2")
> > >         .to("http://dummy")
> > >         ;
> > >
> > >
> > >
> > > In this route, I first make a “POST” request, then a “GET” request.
> > >
> > > I works fine as per my mock logs:
> > >
> > >
> > >
> > > 2020-09-24 14:55:52.789  INFO 104320 --- [           main]
> > > o.a.c.i.e.InternalRouteStartupManager    : Route: init started and
> > > consuming from: timer://hello
> > >
> > > 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> > > o.a.c.impl.engine.AbstractCamelContext   : Total 1 routes, of which 1 are
> > > started
> > >
> > > 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> > > o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> > > started in 0.106 seconds
> > >
> > > 2020-09-24 14:55:52.802  INFO 104320 --- [           main]
> > > com.example.demo.DemoApplication         : Started DemoApplication in 2.239
> > > seconds (JVM running for 10.848)
> > >
> > > 2020-09-24 14:55:53.920  INFO 104320 --- [- timer://hello] before call
> > > 1                            : Exchange[ExchangePattern: InOnly, BodyType:
> > > null, Body: [Body is null]]
> > >
> > > 2020-09-24 14:55:54.071  INFO 104320 --- [- timer://hello] before call
> > > 2                            : Exchange[ExchangePattern: InOnly, BodyType:
> > > String, Body: dummyBody]
> > >
> > >
> > >
> > > The mock logs confirms this, as we can see in the timestamps:
> > >
> > >
> > >
> > >
> > >
> > > However, in the APM logs of Kibana, I see this:
> > >
> > >
> > >
> > > The HTTP operation are incorrect.
> > >
> > > It seems (?) that the operation are based on the fact that the
> > > Exchange body is null or not. Is that the expected behavior ?
> > >
> > >
> > >
> > > Thanks!
> > >
> >
> >
> > --
> > Claus Ibsen
> > -----------------
> > http://davsclaus.com @davsclaus
> > Camel in Action 2: https://www.manning.com/ibsen2
>
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Camel Opentracing and incorrect HTTP method

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

Ah yeah so there is a idiom that Camel selects either GET or POST
depending on whether the body is null or not.
But since you have an explicit header with the http operation to use,
then that ought to take presence.

So the span may report something different than what http actually was
using. You can maybe check the HTTP logs or the logs from camel-http
if you turn on DEBUG/TRACE logging to see what it used actually.

On Thu, Sep 24, 2020 at 4:16 PM CASAUX Nicolas
<ni...@soprasteria.com> wrote:
>
> Hello Claus,
>
> Sorry I thought I could send screenshots...
>
> Actually both spans have the wrong http method:
>
> First span (of the actual POST):
>
>     "@timestamp": "2020-09-24T12:55:53.923Z",
>     "ecs": {
>       "version": "1.5.0"
>     },
>     "service": {
>       "name": "DemoApplication"
>     },
>     "processor": {
>       "name": "transaction",
>       "event": "span"
>     },
>     "transaction": {
>       "id": "1db11aa7eaf9f1f1"
>     },
>     "labels": {
>       "component": "camel-http",
>       "http_method": "GET",
>       "http_status_code": 200,
>       "camel_uri": "http://dummy",
>       "http_url": "http://localhost:3000/answer"
>     }
>
> Second span (of the actual GET):
>
>     "@timestamp": "2020-09-24T12:55:54.071Z",
>     "ecs": {
>       "version": "1.5.0"
>     },
>     "service": {
>       "name": "DemoApplication"
>     },
>     "processor": {
>       "name": "transaction",
>       "event": "span"
>     },
>     "transaction": {
>       "id": "1db11aa7eaf9f1f1"
>     },
>     "labels": {
>       "component": "camel-http",
>       "http_method": "POST",
>       "http_status_code": 200,
>       "camel_uri": "http://dummy",
>       "http_url": "http://localhost:3000/answer"
>     },
>
> That made me think that the "http_method" in the span is maybe determined on the exchange body (null or not null) ?
>
>
> -----Message d'origine-----
> De : Claus Ibsen <cl...@gmail.com>
> Envoyé : jeudi 24 septembre 2020 16:04
> À : users@camel.apache.org
> Objet : Re: Camel Opentracing and incorrect HTTP method
>
> Hi
>
> We cannot see your screenshots.
>
> Are you saying that in kibana that one trace is wrong and that its potential because the body is null, and that the other trace is ok ?
>
> On Thu, Sep 24, 2020 at 3:03 PM CASAUX Nicolas < nicolas.casaux@soprasteria.com> wrote:
>
> > Hello, !
> >
> >
> >
> > Trying to play with Camel 3.5.0 and Opentracing on Springboot, with
> > Elastic APM, with this simple route:
> >
> >
> >
> > from("timer:hello?repeatCount=1&delay=1000").routeId("init")
> >         .setBody(constant(null))
> >         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*POST*))
> >         .setHeader(Exchange.*HTTP_URI*,constant("
> > http://localhost:3000/answer"))
> >         .to("log:before call 1")
> >         .to("http://dummy")
> >         .setBody(constant("dummyBody"))
> >         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*GET*))
> >         .setHeader(Exchange.*HTTP_URI*,constant("
> > http://localhost:3000/answer"))
> >         .to("log:before call 2")
> >         .to("http://dummy")
> >         ;
> >
> >
> >
> > In this route, I first make a “POST” request, then a “GET” request.
> >
> > I works fine as per my mock logs:
> >
> >
> >
> > 2020-09-24 14:55:52.789  INFO 104320 --- [           main]
> > o.a.c.i.e.InternalRouteStartupManager    : Route: init started and
> > consuming from: timer://hello
> >
> > 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> > o.a.c.impl.engine.AbstractCamelContext   : Total 1 routes, of which 1 are
> > started
> >
> > 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> > o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> > started in 0.106 seconds
> >
> > 2020-09-24 14:55:52.802  INFO 104320 --- [           main]
> > com.example.demo.DemoApplication         : Started DemoApplication in 2.239
> > seconds (JVM running for 10.848)
> >
> > 2020-09-24 14:55:53.920  INFO 104320 --- [- timer://hello] before call
> > 1                            : Exchange[ExchangePattern: InOnly, BodyType:
> > null, Body: [Body is null]]
> >
> > 2020-09-24 14:55:54.071  INFO 104320 --- [- timer://hello] before call
> > 2                            : Exchange[ExchangePattern: InOnly, BodyType:
> > String, Body: dummyBody]
> >
> >
> >
> > The mock logs confirms this, as we can see in the timestamps:
> >
> >
> >
> >
> >
> > However, in the APM logs of Kibana, I see this:
> >
> >
> >
> > The HTTP operation are incorrect.
> >
> > It seems (?) that the operation are based on the fact that the
> > Exchange body is null or not. Is that the expected behavior ?
> >
> >
> >
> > Thanks!
> >
>
>
> --
> Claus Ibsen
> -----------------
> http://davsclaus.com @davsclaus
> Camel in Action 2: https://www.manning.com/ibsen2



-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

RE: Camel Opentracing and incorrect HTTP method

Posted by CASAUX Nicolas <ni...@soprasteria.com>.
Hello Claus,

Sorry I thought I could send screenshots...

Actually both spans have the wrong http method:

First span (of the actual POST):

    "@timestamp": "2020-09-24T12:55:53.923Z",
    "ecs": {
      "version": "1.5.0"
    },
    "service": {
      "name": "DemoApplication"
    },
    "processor": {
      "name": "transaction",
      "event": "span"
    },
    "transaction": {
      "id": "1db11aa7eaf9f1f1"
    },
    "labels": {
      "component": "camel-http",
      "http_method": "GET",
      "http_status_code": 200,
      "camel_uri": "http://dummy",
      "http_url": "http://localhost:3000/answer"
    }

Second span (of the actual GET):

    "@timestamp": "2020-09-24T12:55:54.071Z",
    "ecs": {
      "version": "1.5.0"
    },
    "service": {
      "name": "DemoApplication"
    },
    "processor": {
      "name": "transaction",
      "event": "span"
    },
    "transaction": {
      "id": "1db11aa7eaf9f1f1"
    },
    "labels": {
      "component": "camel-http",
      "http_method": "POST",
      "http_status_code": 200,
      "camel_uri": "http://dummy",
      "http_url": "http://localhost:3000/answer"
    },

That made me think that the "http_method" in the span is maybe determined on the exchange body (null or not null) ?


-----Message d'origine-----
De : Claus Ibsen <cl...@gmail.com> 
Envoyé : jeudi 24 septembre 2020 16:04
À : users@camel.apache.org
Objet : Re: Camel Opentracing and incorrect HTTP method

Hi

We cannot see your screenshots.

Are you saying that in kibana that one trace is wrong and that its potential because the body is null, and that the other trace is ok ?

On Thu, Sep 24, 2020 at 3:03 PM CASAUX Nicolas < nicolas.casaux@soprasteria.com> wrote:

> Hello, !
>
>
>
> Trying to play with Camel 3.5.0 and Opentracing on Springboot, with 
> Elastic APM, with this simple route:
>
>
>
> from("timer:hello?repeatCount=1&delay=1000").routeId("init")
>         .setBody(constant(null))
>         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*POST*))
>         .setHeader(Exchange.*HTTP_URI*,constant("
> http://localhost:3000/answer"))
>         .to("log:before call 1")
>         .to("http://dummy")
>         .setBody(constant("dummyBody"))
>         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*GET*))
>         .setHeader(Exchange.*HTTP_URI*,constant("
> http://localhost:3000/answer"))
>         .to("log:before call 2")
>         .to("http://dummy")
>         ;
>
>
>
> In this route, I first make a “POST” request, then a “GET” request.
>
> I works fine as per my mock logs:
>
>
>
> 2020-09-24 14:55:52.789  INFO 104320 --- [           main]
> o.a.c.i.e.InternalRouteStartupManager    : Route: init started and
> consuming from: timer://hello
>
> 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> o.a.c.impl.engine.AbstractCamelContext   : Total 1 routes, of which 1 are
> started
>
> 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> started in 0.106 seconds
>
> 2020-09-24 14:55:52.802  INFO 104320 --- [           main]
> com.example.demo.DemoApplication         : Started DemoApplication in 2.239
> seconds (JVM running for 10.848)
>
> 2020-09-24 14:55:53.920  INFO 104320 --- [- timer://hello] before call
> 1                            : Exchange[ExchangePattern: InOnly, BodyType:
> null, Body: [Body is null]]
>
> 2020-09-24 14:55:54.071  INFO 104320 --- [- timer://hello] before call
> 2                            : Exchange[ExchangePattern: InOnly, BodyType:
> String, Body: dummyBody]
>
>
>
> The mock logs confirms this, as we can see in the timestamps:
>
>
>
>
>
> However, in the APM logs of Kibana, I see this:
>
>
>
> The HTTP operation are incorrect.
>
> It seems (?) that the operation are based on the fact that the 
> Exchange body is null or not. Is that the expected behavior ?
>
>
>
> Thanks!
>


--
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2

Re: Camel Opentracing and incorrect HTTP method

Posted by Claus Ibsen <cl...@gmail.com>.
Hi

We cannot see your screenshots.

Are you saying that in kibana that one trace is wrong and that its
potential because the body is null, and that the other trace is ok ?

On Thu, Sep 24, 2020 at 3:03 PM CASAUX Nicolas <
nicolas.casaux@soprasteria.com> wrote:

> Hello, !
>
>
>
> Trying to play with Camel 3.5.0 and Opentracing on Springboot, with
> Elastic APM, with this simple route:
>
>
>
> from("timer:hello?repeatCount=1&delay=1000").routeId("init")
>         .setBody(constant(null))
>         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*POST*))
>         .setHeader(Exchange.*HTTP_URI*,constant("
> http://localhost:3000/answer"))
>         .to("log:before call 1")
>         .to("http://dummy")
>         .setBody(constant("dummyBody"))
>         .setHeader(Exchange.*HTTP_METHOD*, constant(HttpMethods.*GET*))
>         .setHeader(Exchange.*HTTP_URI*,constant("
> http://localhost:3000/answer"))
>         .to("log:before call 2")
>         .to("http://dummy")
>         ;
>
>
>
> In this route, I first make a “POST” request, then a “GET” request.
>
> I works fine as per my mock logs:
>
>
>
> 2020-09-24 14:55:52.789  INFO 104320 --- [           main]
> o.a.c.i.e.InternalRouteStartupManager    : Route: init started and
> consuming from: timer://hello
>
> 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> o.a.c.impl.engine.AbstractCamelContext   : Total 1 routes, of which 1 are
> started
>
> 2020-09-24 14:55:52.795  INFO 104320 --- [           main]
> o.a.c.impl.engine.AbstractCamelContext   : Apache Camel 3.5.0 (camel-1)
> started in 0.106 seconds
>
> 2020-09-24 14:55:52.802  INFO 104320 --- [           main]
> com.example.demo.DemoApplication         : Started DemoApplication in 2.239
> seconds (JVM running for 10.848)
>
> 2020-09-24 14:55:53.920  INFO 104320 --- [- timer://hello] before call
> 1                            : Exchange[ExchangePattern: InOnly, BodyType:
> null, Body: [Body is null]]
>
> 2020-09-24 14:55:54.071  INFO 104320 --- [- timer://hello] before call
> 2                            : Exchange[ExchangePattern: InOnly, BodyType:
> String, Body: dummyBody]
>
>
>
> The mock logs confirms this, as we can see in the timestamps:
>
>
>
>
>
> However, in the APM logs of Kibana, I see this:
>
>
>
> The HTTP operation are incorrect.
>
> It seems (?) that the operation are based on the fact that the Exchange
> body is null or not. Is that the expected behavior ?
>
>
>
> Thanks!
>


-- 
Claus Ibsen
-----------------
http://davsclaus.com @davsclaus
Camel in Action 2: https://www.manning.com/ibsen2