Skip to content

census: expose client interceptors #12050

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

AgraVator
Copy link
Contributor

No description provided.

/**
* Returns a {@link ServerStreamTracer.Factory} with default stats implementation.
*/
public static ServerStreamTracer.Factory getServerStreamTracerFactory(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These boolean arguments were for internal and for testing. The lots-of-args version was for unit testing the class. Let's only have a zero-argument version at this time. Ditto for client-side.

Copy link
Contributor Author

@AgraVator AgraVator May 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But wouldn't a no arg version restrict the user to not be able to configure it according to their needs ?
Also, I do see the relevant args in ManagedChannelImplBuilder...

* @param serverStreamTracerFactory the server stream tracer factory to configure
*/
public static void configureServerBuilder(ServerBuilder<?> serverBuilder,
ServerStreamTracer.Factory serverStreamTracerFactory) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ServerStreamTracer.Factory itself is unstable API, so having the user pass in the factory doesn't help at all; they could just call addStreamTracerFactory() directly at that point. Instead, we'll want this method to create+add the factory, so the user never sees the factory.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood. I initially included it as an argument because I was exposing two different versions of ServerStreamTracer.Factory, and I wanted to give users the flexibility to choose which one they needed. But I see your point—if the API itself is unstable, it's better to encapsulate the factory creation and registration so that users don't interact with it directly. I'll revise the method to handle that internally.

/**
* Returns a {@link ServerStreamTracer.Factory} with default stats implementation.
*/
public static ServerStreamTracer.Factory getServerStreamTracerFactory(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to make clear what is stats and what is tracing.

import io.opencensus.tags.propagation.TagContextBinarySerializer;
import io.opencensus.trace.Tracing;

public final class GrpcCensus {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javadoc

import io.opencensus.tags.propagation.TagContextBinarySerializer;
import io.opencensus.trace.Tracing;

public final class GrpcCensus {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add private constructor to prevent construction.

@AgraVator AgraVator marked this pull request as ready for review May 13, 2025 04:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants