Open prad69 opened 7 years ago
Well... Whats in the logs? Also try setting org.stagemonitor to debug.
Hi Felix, Even I tried a sample Spring boot hello world application with Java8 and included all the stage monitor dependencies. I dont see any stage monitor browser widget. Here is the sample code below which I tried
package com.stagemonitor.Demo;
import javax.servlet.ServletContext;
import javax.servlet.ServletException;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.embedded.ConfigurableEmbeddedServletContainer;
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
import org.springframework.boot.context.embedded.ServletContextInitializer;
import org.springframework.stereotype.Component;
import org.stagemonitor.core.Stagemonitor;
import org.stagemonitor.core.configuration.ConfigurationOption;
import org.stagemonitor.web.WebPlugin;
@SpringBootApplication
public class Application {
private static final String WEB_PLUGIN = "Web Plugin";
public static void main(String[] args) {
Stagemonitor.init();
SpringApplication.run(Application.class, args);
}
@Component
public static class StagemonitorEnabler implements EmbeddedServletContainerCustomizer {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.addInitializers(new ServletContextInitializer() {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
new WebPlugin().onStartup(null, servletContext);
}
});
}
}
}
package com.stagemonitor.Demo;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
@RestController
@EnableAutoConfiguration
public class MainController {
private final Logger log = LoggerFactory.getLogger(MainController.class);
StageMonitor stg = new StageMonitor();
@RequestMapping("/")
@ResponseBody
public String monitorRequests() {
log.info("Monitoring requests in SpringBoot");
return stg.displayLog();
}
}
stagemonitor.applicationName=StageMonitor Demo
stagemonitor.instrument.include=com.rest.RestService
stagemonitor.instanceName=StageMonitor Demo
stagemonitor.active=true
stagemonitor.web.widget.enabled=true
stagemonitor.requestmonitor.http.collectHeaders=true
stagemonitor.requestmonitor.collectRequestStats=true
stagemonitor.profiler.logCallStacks=true
stagemonitor.profiler.active=true
I enabled the widget in stagemonitor.properties as shown here. After hitting the service URL, I could see the performance stat report in the console but not able to see any browser widget in browser. It would be great if I can get any clue to resolve this issue
Thx for your request, I will check asap.
Hi @sreeaccy,
I think the problem is that you are not rendering any HTML. Stagemonitor injects the widget in HTML pages your application generates. So if you only return plain text like this:
@ResponseBody
public String monitorRequests()
... there is no HTML where the in browser widget could be injected. However, you should be able to see the widget under /stagemonitor
.
See https://github.com/stagemonitor/stagemonitor-integration-tests/tree/master/spring-boot-sample-jpa for a working example.
Thanks much Felix. I tried and it works!
:)
Hi Felix, I am having a similar issue. I have Spring boot app with RESTful services (no UI). When I hit http://localhost:8080/stagemonitor I do not see any call tree or requests data. Its all empty. Did I miss something?
When hitting /stagemonitor
you can't see call trees. Call trees can only be seen in the widget when you have a UI as the call tree gets "injected" into the html pages. To see the call trees for your REST application, you have to look in Kibana.
Thanks for the reply Felix. 2 questions. Do I need to set up the JVM agent options on the app side if I just use to export metrics to Elasticsearch/Kibana? How does stagemonitor aggregate stats when I hit the load balancer?
Do I need to set up the JVM agent options on the app side if I just use to export metrics to Elasticsearch/Kibana?
Stagemonitor does not require you to set up the -javaagent
option as it uses runtime attachment of the agent.
How does stagemonitor aggregate stats when I hit the load balancer?
The in browser widget does not aggregate anything. It only shows you the metrics of the server you are currently hitting.
As you said, I cannot use in browser widget anyway since my app is only REST based. My question was to know how to aggregate all the metrics from different hosts in Kibana.
By default you get aggregated values across all nodes but you can also view metrics of specific nodes.
Thanks Felix. Stagemonitor is not able to reach ES cluster with authentication. I see that you fixed this in 0.31.0 where you can specifify the user:password in the url. But Stagemonitor throws error with latest version. elasticsearch is not reachable at https://admin:passxxx@ps.kibana.v2.aws.esl.com:9200 When I curl the above url works just fine.
Could you post the error?
SLF4J: Actual binding is of type [ch.qos.logback.classic.util.ContextSelectorStaticBinder]
2017-02-02 13:13:01,250 ERROR [main] org.stagemonitor.core.Stagemonitor - Property stagemonitor.elasticsearch.configurationSourceProfiles was set but elasticsearch is not reachable at https://admin:passxxx@ps.kibana.v2.aws.esl.com:9200
java.lang.IllegalStateException: Property stagemonitor.elasticsearch.configurationSourceProfiles was set but elasticsearch is not reachable at https://admin:passxxx@ps.kibana.v2.aws.esl.com:9200
at org.stagemonitor.core.StagemonitorCoreConfigurationSourceInitializer.assertElasticsearchIsAvailable(StagemonitorCoreConfigurationSourceInitializer.java:61) ~[stagemonitor-core-0.31.0.jar:0.31.0]
at org.stagemonitor.core.StagemonitorCoreConfigurationSourceInitializer.addElasticsearchConfigurationSources(StagemonitorCoreConfigurationSourceInitializer.java:47) ~[stagemonitor-core-0.31.0.jar:0.31.0]
at org.stagemonitor.core.StagemonitorCoreConfigurationSourceInitializer.onConfigurationInitialized(StagemonitorCoreConfigurationSourceInitializer.java:40) ~[stagemonitor-core-0.31.0.jar:0.31.0]
at org.stagemonitor.core.Stagemonitor.reloadPluginsAndConfiguration(Stagemonitor.java:276) [stagemonitor-core-0.31.0.jar:0.31.0]
at org.stagemonitor.core.Stagemonitor.reset(Stagemonitor.java:251) [stagemonitor-core-0.31.0.jar:0.31.0]
at org.stagemonitor.core.Stagemonitor.<clinit>(Stagemonitor.java:41) [stagemonitor-core-0.31.0.jar:0.31.0]
at com.aol.cmi.application.Application.main(Application.java:24) [bin/:na]
Caused by: java.io.IOException: Server returned HTTP response code: 401 for URL: https://admin:passxxx@ps.kibana.v2.aws.esl.com:9200/
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1838) ~[na:1.8.0_25]
Hi Felix, did you get a chance to look into this? I am not able to export anything to ES which is behind the basic auth.
I probably won't have time until Friday, I'm afraid
NP. Will look forward to your response.
Hi @ksuvarna34,
I've tested the code both with a unit test and with https://github.com/rasata/http-server-basicauth-ssl. The basic authentication seems to work fine. So I think this might be a configuration problem.
Hi Felix, below is my configuration. Anything missing? stagemonitor.instrument.include=com.ce.cm stagemonitor.instrument.exclude=com.ce.cm.model
stagemonitor.applicationName=cm-pref-local stagemonitor.instanceName=StageMonitor_Pref_Local stagemonitor.active=true stagemonitor.web.widget.enabled=true stagemonitor.requestmonitor.http.collectHeaders=true stagemonitor.requestmonitor.collectRequestStats=true stagemonitor.profiler.logCallStacks=true stagemonitor.profiler.active=true stagemonitor.instrument.debug=true
stagemonitor.elasticsearch.configurationSourceProfiles=local stagemonitor.elasticsearch.url=https://admin:pasxxx@ps.kibana.v1.aws.ce.com:9200/ stagemonitor.requestmonitor.cpuTime=true stagemonitor.reporting.elasticsearch.deleteMetricsAfterDays=5
@ImportResource({"classpath:spring/*-context.xml"}) @ComponentScan(basePackages={"com.ce.cm"}) @EnableAutoConfiguration(exclude={SecurityAutoConfiguration.class}) public class Application {
public static void main(String[] args) {
Stagemonitor.init();
SpringApplication.run(Application.class, args);
}
@Component
public static class StagemonitorEnabler implements EmbeddedServletContainerCustomizer {
@Override
public void customize(ConfigurableEmbeddedServletContainer container) {
container.addInitializers(new ServletContextInitializer() {
@Override
public void onStartup(ServletContext servletContext) throws ServletException {
new WebPlugin().onStartup(null, servletContext);
}
});
}
}
Sorry my bad. stagemonitor.elasticsearch.configurationSourceProfiles=local was the problem. Removed that and I am able to connect now. Thanks
Hi Felix, I created json template files to customize the stagemonitor-requests- index to ce-requests- but it doesn't seem to take effect. I still see the requests and metrics under index stagemonitor-requests- stagemonitor-metrics- Did I miss anything? Below are my stagemonitor.properties file and I have the json files in the classpath but still not picked up.
stagemonitor.reporting.elasticsearch.metricsIndexTemplate=ce-metrics-index-template.json stagemonitor.requestmonitor.elasticsearch.requestIndexTemplate=ce-request-index-template.json
You can't change the index the requests and metrics are sent to. You can only change the elasticsearch mapping.
Mmm. Then how will I differentiate between differnent environments like DEV, QA, Stage if they all fall under the same index?
That's what the instance name is for :)
OK Got it. So the index will always be stagemonitor-* and the dashboards (Request Analysis, Request Metrics) will also be the same? Once I am in the dashboard I have to filter the application name and see the stats. Is that right?
Thats right. One alternative would be to host multiple ES servers for each environment.
Thanks for the reply. For prod we don't have an issue as we have separate ELK stack. But we only have 1 for both DEV and QA. I can manage with that. Sorry to ask a different question on this thread. When I use Dropwizard metrics annotations @Timed, @Metred I do not see the metrics under the metrics dashboard. Do I have to create my own dashboard to get those metrics? Or is they any other configuration I have to do other than using just the annotations on the methods?
The metrics for the Dropwizard annotation metrics are in the "Custom Metrics" Grafana dashboard. There currently is no Kibana dashboard I'm afraid. But you could easily build your own dashboard if you don't want to use Grafana.
Here is an example for a simple graph which shows the timers:
Thanks a lot Felix. Will try that. I don't see JVM and OS (included OS plugin) dashboards in Kibana. Are they only available in Graphana? If so any plans to add them to Kibana in the near future?
Those dashboards should already be available in Kibana. Make sure you have included stagemonitor-jvm and stagemonitor-os. Also note that the OS dashboard is called "Host".
Awesome. Found it. Thanks much Felix.
np :)
Hi Felix, Is there a way I can override Stagemonitor dashboard names in Kiabana? I have 6 microservices pushing Stats to the same ES. I know you mentioned indexes won't change but how about dashboards? Can I get different dashboards for these separate services? Like CM-Request Analysys, OR-Request Anaylisis etc.
Sure, you can just save the dashboard under different names.
I can do that in Kibana but I was wondering if can do that in app itself in stagemonitor.properties or any other configuration. If I don't do that in application then all the different apps stats will be under 1 Request Analysis dashboard and I have manually create separate dashboards.
There is no config option for that.
Thanks. So I have to split the Request Analysis dashboards based on the app name in Kibana.
Felix, I do not see any stats under stagemonitor-external-requests-*. I know the documentation mentioned only JDBC external requests at this time. I would like to see external HTTP requests monitored. Any idea when can we expect this? Most of our external requests are HTTP REST services.
Which http client are you using?
ksuvarna34 notifications@github.com schrieb am Do., 16. Feb. 2017 17:23:
Felix, I do not see any stats under stagemonitor-external-requests-*. I know the documentation mentioned only JDBC external requests at this time. I would like to see external HTTP requests monitored. Any idea when can we expect this? Most of our external requests are HTTP REST services.
— You are receiving this because you commented.
Reply to this email directly, view it on GitHub https://github.com/stagemonitor/stagemonitor-mailinglist/issues/38#issuecomment-280379540, or mute the thread https://github.com/notifications/unsubscribe-auth/ACEDCMl6nHZvy07I1ZWcxeYIvLvKxhDTks5rdHfjgaJpZM4LTP7l .
Spring framework Rest Templates
Its planned for the near Future
Thanks.
Hi, I tried installing the dependencies and also configured the java system properties,but i dont see the stage monitor browser widget. the application is based on spring MVC and java 8. Please let me know any steps for debugging the issue.