spring boot and datadog getting metrics - spring-boot

I have configured the following in my application but i cant seem to get some metrics from http.servlet.request published to datadog.
Spring 2.7.1
implementation("com.datadoghq:dd-trace-ot:0.98.1")
implementation("com.datadoghq:dd-trace-api:0.98.1")
implementation("io.micrometer:micrometer-core:1.9.2")
implementation("io.micrometer:micrometer-registry-statsd:1.9.2")
My props is as follows
management.endpoint.health.probes.enabled=true
management.metrics.export.datadog.step=1m
management.metrics.distribution.percentiles-histogram.http.server.requests=true
management.metrics.export.datadog.descriptions=true
management.metrics.web.server.request.autotime.enabled=true
management.endpoint.metrics.enabled=true
management.metrics.enable.logback=true
management.metrics.tags.application=my-app
management.metrics.export.statsd.enabled=true
management.metrics.export.statsd.host=${DD_HOST}
management.metrics.export.statsd.flavor=datadog
management.metrics.export.statsd.port=8125
So i can see http.servlet.request, but i cant seem to get http.servlet.request.max or http.servlet.request.count.. i really wanted latency is that even possible?
im using tomcat with spring as per standard, Anyone got any ideas why this would be the case why im not seeing

Related

How to trace total in/out bandwidth used by users in spring boot application?

After some researching, I have discovered that there is a spring actuator project which is used to monitor and log information about the application. Here is the link that suggests how to put log in to my own custom repository for post processing. [http://www.sedooe.com/2017/08/tracing-requests-and-responses-with-spring-boot-actuator/ ]
However, the total in/out byte counts are not included. I know that I can try to wrap HttpServeletRequest and HttpServeletResponse (in the filter, pass them to the filter chain so that it can count in/out throughput whenever they are consumed or written out) which will return custom SerlvetInputStream and ServletOutputStream that can count the number of bytes.
This seems to be a common problem in business application and there should already be a solution so I wonder if there is any easier way to achieve this.
From my understanding the Spring-Boot 1.5 actuator implementation doesn't provide such a functionality. (Assuming you are talking about Spring-Boot 1.5.)
What you could do is having a look at the Micrometer project. It's the new actuator metrics "backend" for Spring-Boot 2.0. In case you are still using Spring-Boot 1.5 you can use the micrometer-spring-legacy library in your app.
Key thing to understand here is that for Spring-Boot 1.5 this is a metric backend which is living next to the "old" actuator.
What the project provides is instrumentation for embedded Jetty and Tomcat server. Allthough only the latter does provide in and out traffic metrics.
Assuming Tomcat, you'll get tomcat_global_received_bytes_total and tomcat_global_sent_bytes_total metrics over which you can reason about in your favorite monitoring system.

Can someone explain the flow of execution of spring boot application?

I am working on a spring boot application.
I wanted to know what happens when the application started running and before it becomes ready for user interaction.
I tried going through the console logs but I am still unsure as to what happens when.
I believe you should elaborate a bit more your question. That's because you can build different types of applications using Spring Boot. In a nutshell, during the start up the application will basically try to load the "beans" defined in the related context(s), pre-configured components, define the active profile, properties files, etc. Also some Spring and application events are generated during the start up.
A good way to understand what's going on behind the scenes is running the application in DEBUG mode. By default, the log level of the application is set as INFO.
Have a look at this link for further details:
http://docs.spring.io/spring-boot/docs/current-SNAPSHOT/reference/htmlsingle/#boot-features-spring-application
I hope this can help you as start point.

Spring cloud stream #InboundChannelAdapter not working

I am trying to get the easiest spring cloud stream example to work, so I decided to implement the one from the reference guide reference guide.
I want it to work with kafka so I made too application both with
spring-cloud-starter-stream-kafka
as a dependency. I also tried with rabbitMq by replacint it with
spring-cloud-starter-stream-rabbit
I can't get it to work however. I don't get any exceptions and i can see that the source puts works, the sink however isn't printing the message. I am sure that it connects correctly to kafka/rabbitMq, because i don't get any exceptions and if i don't run kafka/rabbitMq I do get exceptions. I am also using the destination parameter when i run the apps (like it says in the guide), so it should be using the same destination.
I am using spring boot 1.4.2.RELEASE and spring cloud Camden.SR2
Anyone know what i missed?

Spring YARN: How to create a Tracking UI and correctly wire a proxy to it?

I want to deploy an application with a web interface. I want to use Spring YARN for this because that eases all the basic setup, and I can start the application with java -jar.
What steps do I have to do to:
have my application expose a web interface
have the tracking URI I get when submitting it proxy to that web interface
Unfortunately, I cannot find anything about this on the net, there is npthing on that particular issue in the Spring documentation and Google searches do not get me the correct results either.
Easiest way to do this is simply use Spring YARN Boot application model and framework is then trying to do the heavy lifting on your behalf. I actually showed a demo of this during my session at SpringOne 2GX 2014. You can find my session recording from youtube https://www.youtube.com/watch?v=qlvX7_r9aUA.
Interesting stuff for this particular feature is at the end (starting from 1:16:22) and you can see how web server address is registered into YARN resource manager and how I query it using a Spring YARN Boot CLI (around 1:32:13). Spring YARN will actually see that there is an embedded servlet context and registers it automatically. In this demo property "server.port=0" makes tomcat to choose random port which is then registered.
Code for this particular UI demo can be found from github https://github.com/SpringOne2GX-2014/JanneValkealahti-SpringYarn/tree/master/gs-yarn-rabbit. Demo was around RabbitMQ just to have some real UI functionality and not just a dummy hello world page.
There's also more up-to-date sample in https://github.com/spring-projects/spring-hadoop-samples/tree/master/boot/yarn-store-groups which doesn't have a real UI(just Boot management endpoints). Thought it's relatively easy to add Spring MVC magic there just by following normal Boot functionality(i.e. following https://spring.io/guides/gs/rest-service).
Lemmy know if this helps!

HawtIO + Camel plugin - Multiple context not showing up - Limits to max3

Our application is enterprise application which contains multiple web application. Each web application contains one or more camel context. Recently we are exploring the option of using HawtIO for monitoring and administrative purposes.
We are using camel (fuse) version -2.12.0.redhat-610379 with Wildfly 8.1(Dev env -prod being WAS8.5). I have tried with HawtIO web app version ranging from 1.4.10 to 14 and with no-slf4j version as well. But HawtIO is showing maximum 3 camelcontext only. I have tried giving managementNamePattern as well but still no postive results.
If I comment out some of listed camel contexts then other one are getting listed. Please note that each camel context would contain around 10 to 15 routes and endpoint (spring beans) will be around 30 .
But I am able to find unlisted camel context in JMX Dashboard under org.apache.camel. Kindly let me know any work around for it or if I am missing something in configuration. My camel context would refer multiple route context.
Not sure if you still need to know this, but what you may need to do is in the HawtIO preferences, under Jolokia, increase the "Max Collection Size", as HawtIO just grabs everything and then appears to filter on the client side, so if you have a lot of MBeans, you won't see everything (as it only fetches the first 500 entries by default).
I had a similar issue - but while I was seeing all the camel contexts, I was not seeing all the routes, which was the big issue for me.
It defaults to 500. I increased it to 5000, which was enough for me. You may wish to try fiddling with that yourself, and see if it makes a difference.

Resources