Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using StageMonitor to output metrics to logger #72

Open
LarsMilland opened this issue Apr 11, 2018 · 0 comments
Open

Using StageMonitor to output metrics to logger #72

LarsMilland opened this issue Apr 11, 2018 · 0 comments

Comments

@LarsMilland
Copy link

Hi

I am trying get StageMonitor to output the metrics that usually go to ElasticSearch to a console logger, with logback. But

I can't seem to get anything of metric sample kinds to work.

I have this StageMonitor configuration:

stagemonitor.applicationName=Demo
stagemonitor.internal.monitoring=true
stagemonitor.instrument.debug=true 
stagemonitor.tracing.tags.excluded=call_tree_json, call_tree_ascii
stagemonitor.instanceName=Development

stagemonitor.instrument.include=my.org
stagemonitor.instrument.exclude=my.eorg.domain, org.jolokia.http

stagemonitor.reporting.interval.console=30

stagemonitor.web.paths.excluded=/resources, /webjars
stagemonitor.password=

stagemonitor.tracing.elasticsearch.onlyLogElasticsearchRequestTraceReports=true
stagemonitor.reporting.elasticsearch.onlyLogElasticsearchMetricReports=true
stagemonitor.reporting.interval.elasticsearch=30

# Dummy ElasticSearch URL
stagemonitor.reporting.elasticsearch.url=http://localhost:4444
stagemonitor.reporting.elasticsearch.username=dummy
stagemonitor.reporting.elasticsearch.password=dummy
stagemonitor.configuration.elasticsearch.deactivateStagemonitorIfEsIsDown=false

stagemonitor.alerts.frequency=30
stagemonitor.tracing.sampling.percent.default=0.2

The application that I am trying this on is a Java Spring Boot application, where I have this for starting up StageMonitor:

	public static void main(String[] args) {
        Stagemonitor.init();
		SpringApplication.run(DemoApplication.class, args);
	}

	
	
    @Component
    public static class StagemonitorInitializer implements ServletContextInitializer {

        @Override
        public void onStartup(ServletContext servletContext) throws ServletException {
            ServletContainerInitializerUtil.registerStagemonitorServletContainerInitializers(servletContext);
        }
    }

Running my application I can see that StageMonitor is working - see attachment:

stagemonitor.txt

I can also see that my logback configuration should be working, as the StageMonitor span traces are printed to my console.

I have this in my logback configuration which should match the two loggers that I can expect StageMonitor to use:

    <logger name="ElasticsearchSpanReporter" additivity="false" level="INFO">
        <appender-ref ref="consoleAppender"/>
    </logger>
    <logger name="ElasticsearchMetrics">
        <appender-ref ref="consoleAppender"/>
    </logger>

Where it would be the "ElasticsearchMetrics" logger that should cover the metrics parts if I have read the documentation correctly.

The reason why I have this configuration present:
stagemonitor.reporting.elasticsearch.url
is just to see if would make any difference to get the metrics working. It would also no work without that configuration.

Would anybody know what could be wrong. Or would maybe have working configuration / application they can share where the metrics are written to a logger instead of to the Elasticsearch endpoint.

Best regards
Lars Milland

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant