Code Monkey home page Code Monkey logo

brave-ratpack's People

Contributors

adriancole avatar beckje01 avatar dependabot[bot] avatar drmaas avatar edwardsoo-ss avatar ephyleung avatar hyleung avatar jeff-blaisdell avatar llinder avatar rhart avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

brave-ratpack's Issues

Support Ratpack 1.6

Migrated from hyleung/ratpack-zipkin#64

Ratpack 1.6 is out and should include a client interceptor API now. I suspect we will get better milage from using the interceptors and hope that it may also fix some anomalies around client tracing that have been seen under heavy load.

Add support for Observables

I already have a workaround to support RxJava Observable workloads (rather than using TracedParallelBatch Promises), but it relies on direct access to the TraceContextHolder class which is marked private. This appears to only work in Groovy.

Please add additional options for passing the trace context across threads, or allow users to manually set the trace context back after we switch threads so the Trace code can find it.

Example workaround:

def tracer = Tracing?.current()?.tracer()
TraceContext context = tracer.currentSpan()?.context()
dev action = Observable.just("test")

action.doOnSubscribe {
  Execution.current().add(new RatpackCurrentTraceContext.TraceContextHolder(context))

  tracer.currentSpan().tag("test key", "test value")  
}.subscribe()

Consumer applications not able to customize http client

Because of how the http client is bound in the module, it is difficult for consuming applications to leverage the zipkin interceptors while specifying additional http spec properties like pool size, read timeout, connect timeout, etc. Refer to https://github.com/openzipkin-contrib/brave-ratpack/blob/master/src/main/java/ratpack/zipkin/ServerTracingModule.java#L61

Currently, the way to work around this is to build and inject a non Zipkin annoted client by using copyWith to create an entirely new client. For example (kotlin):

    @Provides
    @Singleton
    fun integrationHttpClient(
        properties: IntegrationProperties,
        @Zipkin httpClient: HttpClient,
        clientTracingInterceptor: ClientTracingInterceptor
    ): HttpClient {
        return httpClient.copyWith {
            it.poolSize(properties.poolSize)
            it.connectTimeout(Duration.ofMillis(properties.connectTimeoutMillis))
            it.readTimeout(Duration.ofMillis(properties.readTimeoutMillis))
            it.idleTimeout(Duration.ofMillis(properties.idleTimeoutMillis))
            it.maxContentLength(properties.maxContentLength)
            // adds compression headers if they don't exist, otherwise leaves existing values in the request
            it.requestIntercept { request ->
                request.headers.add(HttpHeaderNames.ACCEPT_ENCODING, COMPRESSION_VALUE)
                clientTracingInterceptor.request(request)
            }
            it.responseIntercept { clientTracingInterceptor.response(it) }
            it.errorIntercept { clientTracingInterceptor.error(it) }
        }
    }

Is there a nicer way to do this? Or is it a matter of documenting how to layer one's own configurations on top of the built-in zipkin client?

  1. Could we require consumers to bind their own client, and then in this module layer the interceptors on top using copyWith?
  2. Could we then take if further, where if consumer did not provide an http client at all, we build a new one and use that?

Make project multi module

Right now this library has a dependency on ratpack and ratpack-guice. Ideally this should be split into separate modules so users have an easy way to opt out of the Guice libraries if they want.

how to handle ServerRequest and ServerResponse public types

ServerRequest and ServerResponse types are public, so I'm not sure how we should handle them. I'm not sure if they are public as a part of the api, or accidentally so.

I'd like to migrate this to latest brave, but adhering to these might make things a bit more difficult than if they never exists or were package private..

Upgrade Brave version

The latest Brave library has some nice additions. Unfortunately there are some incompatible changes which require a bit more work than just revving the version.

TraceContextHolder Class has to be Singleton

TraceContextHolder Class has to be Singleton

Multiple instance of the same class is found in the registries of the Current Execution object.
This causes RatpackCurrentTraceContext.get() function to return null context on creation of new spans. Hence forming separate traces.

screenshot 7

TracingPropagationExecInitializer searching for wrong class in registry entries.

init function in TracingPropagationExecInitializer is trying to get HttpTracing.class from the execution object i pass but instead it should maybeGet(TraceContextHolder.class).
Since in my registry entries only this is present.
RegistryEntry{type=ratpack.zipkin.internal.RatpackCurrentTraceContext$TraceContextHolder, value=ratpack.zipkin.internal.RatpackCurrentTraceContext$TraceContextHolder@6139672b}.
Hence httpTracing is always null in init.

So init can't be used for manual setting of TraceContext on passing the current Execution because at that point RatpackCurrentTraceContext$TraceContextHolder will be having the CurrentTraceContext and not HttpTracing.class

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.