grpc / grpc/grpc-java

Unable to activate real-time metrics to OpenCensus

Offen
#5,624 15 Kommentare 0 Reaktionen 1 zugewiesene Person Zugewiesen an @zhangkun83 Auf GitHub ansehen
enhancement
Vorherrschende Sprache
Java
Sterne
12.1k
Forks
4k
Ø Merge
2 T. 17 Std.
Gemergte PRs (30 T.)
37

Beschreibung

#5099 implemented a way to record real-time metrics. Cool! Now I'd like to activate it, as it's disabled by default. I'm not successful in enabling this, however.

Tried with a NettyServerBuilder for example, but the `setStatsRecordRealTimeMetrics` method is protected.

I don't see any other way to set the private attribute `recordRealTimeMetrics` in the `AbstractServerImplBuilder` class from the sources.

The work-around I'm using now is ugly in bypassing the protected attribute (Kotlin, but you get my point).

```kotlin
val serverBuilder = NettyServerBuilder.forPort(1234)
val setStatsRecordRealTimeMetricsMethod = NettyServerBuilder::class.java
.getDeclaredMethod("setStatsRecordRealTimeMetrics", Boolean::class.java)
setStatsRecordRealTimeMetricsMethod.setAccessible(true)
setStatsRecordRealTimeMetricsMethod.invoke(serverBuilder, true)
```

after which it starts to work, except from the method name not being exported (but that's #5593).

### What version of gRPC are you using?

1.20.0

### What did you expect to see?

A public function on the Builder to call `setStatsRecordRealTimeMetrics(true)`.

Beitragsleitfaden

Beitragsleitfaden öffnen

Bewertung

Dieses Issue wurde noch nicht bewertet.

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.