Skip to content

Enable adding the gRPC API to tonic without serving #428

@maximelenoir

Description

@maximelenoir

What problem are you trying to solve?

I would like the Server to optionally serve the InstrumentServer after it's been added as a service to the tonic Builder. As of now, the Server implementation starts the aggregator, add the service to tonic and start the gRPC service. Ideally, this last step could be optional, leaving the user the choice of adding more services or using this tonic service in a larger set of services: in my case, I would like to transform the tonic service to a tower service and multiplex it with an Axum service.

How should the problem be solved?

Probably by extending the Service API so that the aggregation is started and the InstrumentService is properly added to tonic, returning a tonic Router. I have a fork that I'm using for production here: 700b80a

There can be a few drawbacks with this:

  • The builder can be configured with a listening port / Unix socket so it might feel surprising to have an API that completely ignores it
  • We lose the fine grained control of the aggregator thread handle (either by dropping it in this new API body or by leaking it to the user)

Any alternatives you've considered?

I did not consider another solution yet.

How would users interact with this feature?

No response

Would you like to work on this feature?

maybe

Metadata

Metadata

Assignees

No one assigned

    Labels

    S-featureSeverity: feature. This is adding a new feature.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions