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.

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:open
  • Created 4 years ago
  • Comments:15 (11 by maintainers)

github_iconTop GitHub Comments

2reactions
ejona86commented, May 14, 2020

We discussed it further, and this is the approach we’re entertaining most strongly:

  1. Add a CensusInterceptor in io.grpc.census. This can have whatever configuration is necessary when being created
  2. Add a disableImplicitCensus() somewhere in io.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
  3. (Maybe) Have a setting on the Channel and Server to disable the implicit census interceptor

@gertvdijk, @mattnworb, would that work for you?

2reactions
mattnworbcommented, May 5, 2020

with the issue linked above complete (there is now a grpc-census), is there any way to enable recordRealTimeMetrics in a ServerBuilder?

Read more comments on GitHub >

github_iconTop 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 >

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