question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Netty Prometheus Integration

See original GitHub issue

Following the Metrics Reporting Guide the server sets up a metric reporter using GrpcServer.default. When I attempt to use GrpcServer.netty I get the following error when pointing prometheus at the service:

INFO: Transport failed
io.netty.handler.codec.http2.Http2Exception: Unexpected HTTP/1.x request: GET /metrics my_server
at io.netty.handler.codec.http2.Http2Exception.connectionError(Http2Exception.java:85)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.readClientPrefaceString(Http2ConnectionHandler.java:314)
at io.netty.handler.codec.http2.Http2ConnectionHandler$PrefaceDecoder.decode(Http2ConnectionHandler.java:251)
....

Is it possible to use this metric reporter with the netty server version?

Hopefully relevant code bits:

object CombinedServerMain extends IOApp with CommonRuntime {
...
override def run(args: List[String]): IO[ExitCode] = {
    for {
      metricsOps <- PrometheusMetrics.build[IO](CollectorRegistry.defaultRegistry)
      interceptor = MetricsServerInterceptor(metricsOps)
      accountService <- AccountService.bindService[IO].map(_.interceptWith(interceptor)).map(AddService)
      server <- GrpcServer.netty[IO](10123, accountService :: Nil)
      runServer <- GrpcServer.server[IO](server).as(ExitCode.Success)
    } yield runServer
}

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
TannerYoungcommented, Oct 8, 2019

When using GrpcServer.default[IO] instead of netty; I get the following exception:

java.lang.NoClassDefFoundError: io/grpc/internal/WithLogId
	at java.lang.ClassLoader.defineClass1(Native Method)
 	at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
 	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
 	at java.net.URLClassLoader.defineClass(URLClassLoader.java:468)
	at java.net.URLClassLoader.access$100(URLClassLoader.java:74)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:369)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:363)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:362)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
 	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
 	at io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder.buildTransportServer(NettyServerBuilder.java:432)
 	at io.grpc.netty.shaded.io.grpc.netty.NettyServerBuilder.buildTransportServer(NettyServerBuilder.java:55)
	at io.grpc.internal.AbstractServerImplBuilder.build(AbstractServerImplBuilder.java:223)
	at higherkindness.mu.rpc.server.GrpcServer$.buildServer(GrpcServer.scala:113)

Is prometheus integration in a known good state and I’m doing something wrong? Is there updated documentation on how to use it? I’m dependening on the following targets:

io.higherkindness:mu-rpc-netty:0.18.4
io.higherkindness:mu-rpc-server:0.18.4
io.higherkindness:mu-rpc-prometheus:0.18.4
0reactions
fedefernandezcommented, Oct 10, 2019

Glad it worked. I’ve created an issue #677

Read more comments on GitHub >

github_iconTop Results From Across the Web

Reactor Netty Reference Guide
The TCP server supports built-in integration with Micrometer . It exposes all metrics with a prefix of reactor.netty.tcp.server .
Read more >
Spring Webflux - Actuator - Netty thread metrics?
In my app, I expose the endpoints from the /actuator/prometheus route. Meaning I should build a uriMappingFunction mapping to my prometheus ...
Read more >
Monitoring Secure Coroutines and WebFlux Reactive ...
In this article, we will look at one of the many ways to keep an application's behavior closely under watch and use Prometheus...
Read more >
Metrics → Prometheus→ Grafana - Medium
This is a simple example that can get an idea about how to use Metrics and visualize them in Grafana dashboard. Step 1...
Read more >
Dependents | io.netty:netty-codec-http | Maven | Open Source Insights
com.azure.spring:azure-spring-integration-core, Version, 2.1.0, Relation, Indirect ... io.micrometer.prometheus:prometheus-rsocket-proxy-server, Version ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found