This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Aspect | |
public class MethodProfiler { | |
private final StatsDClient statsd; | |
public MethodProfiler(StatsDClient statsd) { | |
this.statsd = statsd; | |
} | |
@Pointcut("execution(* at.willhaben.examples.statsd.rest.RandomController.*(..))") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
example.app.service.random:1|c |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
statsd.incrementCounter("service.random"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@Configuration | |
public class MetricsConfig { | |
@Bean | |
public StatsDClient statsDClient( | |
@Value("${metrics.statsd.host:localhost}") String host, | |
@Value("${metrics.statsd.port:8125}") int port, | |
@Value("${metrics.prefix:example.app}") String prefix | |
) { | |
return new NonBlockingStatsDClient(prefix, host, port); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<dependency> | |
<groupid>com.timgroup</groupid> | |
<artifactid>java-statsd-client</artifactid> | |
<version>3.0.1</version> | |
</dependency> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.*; | |
import java.net.*; | |
/** | |
* Simple UDP server that listens for packets on port 8125 and | |
* prints them. Intended for testing a StatsD client. | |
*/ | |
public class StatsdLogger | |
{ | |
public static void main(String args[]) throws Exception { |
NewerOlder