Question on implementing open tracing with Scala Futures

This page summarizes the projects mentioned and recommended in the original post on /r/scala

Our great sponsors
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • WorkOS - The modern identity platform for B2B SaaS
  • SaaSHub - Software Alternatives and Reviews
  • newrelic-java-agent

    The New Relic Java agent

  • https://github.com/newrelic/newrelic-java-agent/commit/3866b9ff3ffabf0d861f7b822257672b80168f52 This is how I implemented tracing for scala2.13 in new relic. You can't really end the trace in Future.map because that is actually a different Future. If open tracing is using the thread local you are not necessarily in the same thread or getting invoked right when the instrumented future finishes. I found the submit with value is always invoked when a Future is created and the run method surrounded everything that occurred within the Future body. I'm not familiar with open tracing, but my method is working well for my organizations scala apps.

  • natchez

    functional tracing for cats

  • It's never going to work with a ThreadLocal-based implementation because Future (and other Scala async stuff like cats.effect.IO) hop from thread to thread in an unpredictable way. The only way to do it is to jettison the magical "current span" thing and pass the span explicitly. You can hide this in the plumbing if you program with abstract effects (this is what Natchez Trace does) but with Future I think you're going to have to pass everything around in the open.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts