https://github.com/evolution-gaming/stracer
Tools for tracing and span reporting
https://github.com/evolution-gaming/stracer
cats-effect jaeger kafka scala tagless-final thrift zipkin
Last synced: 11 months ago
JSON representation
Tools for tracing and span reporting
- Host: GitHub
- URL: https://github.com/evolution-gaming/stracer
- Owner: evolution-gaming
- License: mit
- Created: 2019-03-20T13:19:35.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2024-09-30T10:53:28.000Z (over 1 year ago)
- Last Synced: 2025-04-23T00:16:05.542Z (about 1 year ago)
- Topics: cats-effect, jaeger, kafka, scala, tagless-final, thrift, zipkin
- Language: Scala
- Size: 267 KB
- Stars: 6
- Watchers: 10
- Forks: 4
- Open Issues: 38
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# STracer
[](https://github.com/evolution-gaming/stracer/actions?query=workflow:CI+branch:master)
[](https://coveralls.io/github/evolution-gaming/stracer?branch=master)
[](https://www.codacy.com/app/evolution-gaming/stracer?utm_source=github.com&utm_medium=referral&utm_content=evolution-gaming/stracer&utm_campaign=Badge_Grade)
[](https://evolution.jfrog.io/artifactory/api/search/latestVersion?g=com.evolutiongaming&a=stracer_2.13&repos=public)
[](https://opensource.org/licenses/MIT)
Library for distributed tracing in Scala
## Span
```scala
final case class Span(
traceId: TraceId,
spanId: SpanId,
name: String,
timestamp: Instant,
kind: Option[Kind] = None,
duration: Option[FiniteDuration] = None,
remoteEndpoint: Option[Endpoint] = None,
tags: Tags = List.empty,
shared: Option[Boolean] = None,
parentId: Option[SpanId])
```
## Trace
```scala
final case class Trace(
traceId: TraceId,
spanId: SpanId,
parentId: Option[SpanId],
timestamp: Option[Instant],
sampling: Option[Sampling] = None)
```
## Tracer
Generate SpanId and Trace
```scala
trait Tracer[F[_]] {
def trace(sampling: Option[Sampling] = None): F[Option[Trace]]
}
```
## ReportSpan
We provide [Kafka](http://kafka.apache.org) based implementation, which uses `SpanBytesEncoder.THRIFT` from [Zipkin](http://zipkin.io/) to encode spans.
It is also compatible with [Jaeger](https://www.jaegertracing.io) & [Ingester](https://www.jaegertracing.io/docs/1.8/deployment/#ingester)
Since version `5.0.0` this implementation is available in separate module `stracer-kafka`.
```scala
trait ReportSpan[F[_]] {
def apply(span: Span): F[Unit]
}
```
## Setup
```scala
addSbtPlugin("com.evolution" % "sbt-artifactory-plugin" % "0.0.2")
libraryDependencies += "com.evolutiongaming" %% "stracer" % "5.0.0"
libraryDependencies += "com.evolutiongaming" %% "stracer-play-json" % "5.0.0"
libraryDependencies += "com.evolutiongaming" %% "stracer-circe" % "5.0.0"
libraryDependencies += "com.evolutiongaming" %% "stracer-kafka" % "5.0.0"
```