Unable to activate real-time metrics to OpenCensus
See original GitHub issue#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).
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)
.
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (11 by maintainers)
Top Results From Across the Web
FAQ - OpenCensus
Who is behind OpenCensus? OpenCensus originates from Google, where a set of libraries called Census were used to automatically capture traces and metrics...
Read more >Write metrics with OpenCensus - Monitoring - Google Cloud
Demonstrates how to write metrics with OpenCensus. ... Fatalf("Failed to register the view: %v", err) } // Enable OpenCensus exporters to export metrics...
Read more >Metrics Data Model - OpenTelemetry
As in OpenCensus Metrics, metrics data can be transformed into one or more Views, ... The metric data model is designed around a...
Read more >Custom metrics with OpenCensus - YouTube
Your browser can't play this video. Learn more. Switch camera.
Read more >How to collect Prometheus metrics with the OpenTelemetry ...
You also need a remote endpoint to send and view your metrics, and one of the easiest ways to store Prometheus metrics is...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
We discussed it further, and this is the approach we’re entertaining most strongly:
io.grpc.census
. This can have whatever configuration is necessary when being createddisableImplicitCensus()
somewhere inio.grpc.census
. If you don’t call this, then the two census interceptors would both be used. It must not be used from library code. We’d probably want a getter for code using CensusInterceptor directly to react@gertvdijk, @mattnworb, would that work for you?
with the issue linked above complete (there is now a grpc-census), is there any way to enable
recordRealTimeMetrics
in a ServerBuilder?