Skip to content
This repository was archived by the owner on Dec 15, 2021. It is now read-only.
This repository was archived by the owner on Dec 15, 2021. It is now read-only.

Support local sampled store for HTTP calls #32

@fiadliel

Description

@fiadliel

Opencensus supports a local store with samples of calls to various endpoints. It can be enabled with a request like

Tracing.getExportComponent
  .getSampledSpanStore
  .registerSpanNamesForCollection(List("/path").asJava))

This can be viewed with https://github.com/census-instrumentation/opencensus-java/tree/master/contrib/zpages

I've looked at the issue of implementing this for http4s, where the problem is that the underlying model is that the route selection and calculation of response are bound together. So when you want to start timing a span, you already have to give it a span name, before you know anything about how that path was converted to a result.

You can't just use the path itself as the name, because you want the cardinality to be low for this store (if, for example, a UUID is encoded in the path, you don't want an entry per UUID).

I've tried implementing this by passing a function Request[F] => String when creating server middleware, to create a "HTTP route" that's used as the span name. The problem is the lack of guarantee that this in any way matches how the HttpService[F] is actually implemented, and that it matches how the matching is done.

I suspect that similar issues are present for akka-http (I'm not that familiar with its API).

Opening this issue so people can offer opinions (perhaps the answer is not to do this).

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions