I'm currently working with Apache Camel and hawt.io for monitoring and debugging my Camel routes. This works wonderfully, even if some important information is somewhat hidden in the documentation. For example, it took me a bit to turn on debugging.
However, if I set a breakpoint where the message processing stops at that point in the route, I can't see any "body" or "headers" of my Camel exchange at that point. I've tried all sorts of settings:
tracing / backlog tracing enabled on CamelContext
tracing / backlog tracing enabled on route
Adjusted settings on MBean "BacklogDebugger" and "BacklogTracer".
Tracing on the "Trace" tab works very well: If I activate tracing in the "Trace" tab, I can see the flow of my message through all nodes of the route.
Only when stopping at the breakpoint is the body and header not displayed.
Edited: After some changes concerning other aspects (like assigning an ID to most of the route nodes) debugging works including display of body and headers. I have no clue what changed to make it work.
And at the same time my application property "camel.main.debugging=true" failed on startup
Error binding property (camel.main.debugging=true) with name: debugging on bean: org.apache.camel.main.MainConfigurationProperties
I had to enabled debugging at the context like this:
getContext().setDebugging(true);
Here is some information:
I don't use any special framework: Plain old Java with a Main method in which I start Camel-Main.
Apache Camel: 3.14.1
Jolokai Agent: 1.7.1
hawt.io: 2.14.5
Exchange body type: DOMSource
One of my routes:
getCamelContext().setBacklogTracing(true);
from(rabbitMqFactory.queueConnect("tso11", "tso11-to-nms", "username"))
.routeGroup("Workflow")
.routeId("Workflow-to-NMS|Map-TSO11-to-NMS42")
.routeDescription("Mapping of TSO11 Message to NMS42")
.convertBodyTo(DOMSource.class)
.log("Message for '$simple{header:tenant}' received")
.process(tso11ToNmsMappingProcessor)
.to("xslt:xslt/tso11-to-nms42.xslt")
.to("direct:send");
And here are my current properties:
camel.main.name=TSO11
camel.main.jmxEnabled=true
camel.main.debugging=true
camel.main.backlogTracing=true
camel.main.lightweight=false
camel.main.tracing=false
camel.main.useBreadcrumb=true
Any ideas? Any hints for a good documentation?
I have some more less important questions but I will open another issue for those.
With kind recards
Bert
Finally here are screenhots of debugging tab (with empty body) and trace tab (with body content):
I found the reason for my problem:
I used Camel 3.15.0 which is currently not supported by the camel plugin of hawt.io.
When using latest 3.14.x it works like a charm :-)
Hopefully there is still a maintainer of the camel plugin who will improve it in the near future. I am willing to contribute but the hawt.io developer information is not accessible and I am not able to understand how to run hawt.io from source locally .... especially how to include the camel plugin, which is in a separate github project.
Related
I am experimenting with different instrumentation libraries but primarily spring-cloud-sleuth and open-telemetry ( OT) are the ones I liked the most. Spring-cloud-sleuth is simple but it will not work for a non-spring ( Jax-RS)project , so I diverted my attention to open telemetry.
I am able to export the metrics using OT, but there is just too much data which I do not need. Spring sleuth gave the perfect solution wherein it just traces the call across microservices and links all the spans with one traceId.
My question is - How to configure OT to get an output similar to spring-sleuth? I tried various configuration and few worked but still the information is huge.
My configuration
-Dotel.traces.exporter=zipkin -Dotel.instrumentation.[jdbc].enabled=false -Dotel.instrumentation.[methods].enabled=false -Dotel.instrumentation.[jdbc-datasource].enabled=false
However, this still gives me method calls and other data. Also, one big pain is am not able to SHUT DOWN metrics data.
gets error like below
ERROR io.opentelemetry.exporter.internal.grpc.OkHttpGrpcExporter - Failed to export metrics. The request could not be executed. Full error message: Failed to connect to localhost/0:0:0:0:0:0:0:1:4317
Anyhelp will be appreciated -
There are 2 ways to configure the open telemetry agent(otel).
Environment variable
Java system property
you can either set
export OTEL_METRICS_EXPORTER=none
or
java -Dotel.metrics.exporter=none app.jar
Reference
https://github.com/open-telemetry/opentelemetry-java/blob/main/sdk-extensions/autoconfigure/README.md
I am trying to run the Camel Salesforce Kafka Source Connector version 1.0.x (LTS) and following the documentation as described on https://camel.apache.org/camel-kafka-connector/1.0.x/reference/connectors/camel-salesforce-source-kafka-source-connector.html all I need to do is to configure a bunch of camel.kamelet.salesforce-source.xxx properties which is exactly what I did.
Let's just assume that camel.kamelet.salesforce-source.clientId=xyz
When trying to run the connector it fails to start complaining that clientId is an unknown parameter:
Failed to resolve endpoint: salesforce://event/Case__e?clientId=xyz due to:
There are 1 parameters that couldn't be set on the endpoint.
Check the uri if the parameters are spelt correctly and that they are properties of the endpoint.
Unknown parameters=[{clientId=xyz}]
Running out of ideas I tried to configure a camel route myself and specified the clientId part of the salesforce endpoint. The issue was exactly the same. Running out of ideas I asked this question Unable to create camel salesforce endpoint and got a valid explanation for that behaviour: This type of settings should be done at component level not at endpoint level.
Digging further I checked that version 0.11.x (LTS) allows us to configure camel.component.salesforce.xxx properties as opposed to 1.0.x (LTS) which only has camel.kamelet.salesforce-source.xxx. In fact I was able to start the 0.11.x (LTS) connector.
Now it is hard to believe the migration from 0.11.x to 1.0.x was not fully tested and I am tempted to say I am missing some basic setup.
Can anyone bring some light in here?
Thank you in advance for your inputs.
I am using OpenTelemetry java auto instrumentation in my spring boot app. Is there a way to make the application logs part of the spans that are created?
My autoconfig settings are as below:
-Dotel.traces.exporter=jaeger
-Dotel.metrics.exporter=none
-Dotel.exporter.jaeger.endpoint=http://localhost:14250
-Dotel.resource.attributes=service.name=myService
-javaagent:C:/path/to/opentelemetry-javaagent-1.0.1-all.jar
OpenTelemetry ships logs separately to the telemetry data obtained from auto instrumentation, and does not interleave log data I'm afraid. We ship our logs via the use of FluentBit (https://medium.com/opentelemetry/introducing-the-fluentbit-exporter-for-opentelemetry-574ec133b4b4).
You may wish to use manual instrumentation and add spans, span attributes and/or events to pertinent code blocks, to add log like context to the metadata utilised downstream.
As you are using Spring Boot, it would be advisable to use one of the starter dependencies, such as opentelemetry-otlp-exporter-starter (https://github.com/open-telemetry/opentelemetry-java-instrumentation/tree/main/instrumentation/spring/starters/otlp-exporter-starter), which should get you most of the way there. You want to use the #WithSpan annotation to decorate your methods, which will enable you to obtain the current span easily. See https://opentelemetry.lightstep.com/java/.
The official docs have a few examples, that may help, but be aware that the API and SDK are changing rapidly, so examples don't always work - https://opentelemetry.io/docs/java/manual_instrumentation/.
Detailed information regarding OpenTelemetry and logging: https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/logs/overview.md
Adding logs to spans depends a bit on the backend you are using for collecting the traces/spans and visualizing them.
I used Jaegar, which interprets OTEL events as logs in the UI, and so I wrote a custom log appender which put app logs into an event, which was picked up subsequently in the UI.
More details here:
https://stackoverflow.com/a/68739794/2715083
I just read the gwt-log Getting Started guide and found it very helpful, however I have a few questions surrounding the Loggers:
The SystemLogger sends output to System.err and System.out - in the context of a client-side web app running inside a browser, where will this output eventually go? Browser logs?
Does RemoteLogger depend on JUL or log4j? I have a homegrown slf4j binding that I like to use for all my Java backends, and would like to use it, but not sure if RemoteLogger will be incompatible with it?
Is it possible to have RemoteLogger hit my own LoggingServiceServlet, which could then translate the log messages coming in on the HttpServletRequest into logging statements that are compatible with my custom slf4j binding? If so, what might this config look like?
Thanks in advance!
In this link, you have a most updated documentation about the GWT logging framework
Answers to your questions:
#1 Yes it works in client side, but only when running the app in DevMode (not in production nor superdev mode). Look for the log lines in the DevMode window, or in your terminal output if you run dev-mode from the command-line.
#2 It depends on java.util.logging, you can change it though (see #3)
#3 Yes you can change the logging framework extending the RemoteLoggingServiceImpl and overriding the logOnServer(LogRecord lr) method.
i'm new to struts... I have a struts form. i need to analyze the data posted to an action class. i just want to output the data to a page and stop further execution so as to test of it is working correctly... how is it done..?
There are many ways to debug a struts application:
Configuration Plugin: You can use configuration plugin provided by struts. To use this plugin include struts2-config-browser-plugin-x.x.x.x.jar jar in your classpath and then you can use
">Launch the configuration browser
anywhere in your application to view a lot of detail about the action class.
The second way is to use Debugging Interceptor by using property debug=true in struts.xml.
See the below link for more details:
http://struts.apache.org/release/2.2.x/docs/debugging-struts.html
The easiest way to quickly and thoroughly inspect http requests and responses and post data is to use either:
http-fox with firefox (download)
chromes' network inspector (pre-installed with chrome - ctrl-shift-i - Network - Click on the appropriate post request and the body of the post will be displayed)
If neither of these very easy tools appeal, you'll have to find the appropriate hook to attach your debugger. I've not used struts since 2002 so cann't advise.
The best method is to use System.out.print and get the result in the tomcat console... i had said i need on server side not client side.