opentracing-sparkjava

Opentracing Request Filters for Sparkjava

Лицензия

Лицензия

Группа

Группа

com.mikelduke
Идентификатор

Идентификатор

opentracing-sparkjava
Последняя версия

Последняя версия

1.0.1
Дата

Дата

Тип

Тип

jar
Описание

Описание

opentracing-sparkjava
Opentracing Request Filters for Sparkjava
Ссылка на сайт

Ссылка на сайт

https://github.com/mikelduke/opentracing-sparkjava
Организация-разработчик

Организация-разработчик

mikelduke
Система контроля версий

Система контроля версий

https://github.com/mikelduke/opentracing-sparkjava

Скачать opentracing-sparkjava

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.mikelduke/opentracing-sparkjava/ -->
<dependency>
    <groupId>com.mikelduke</groupId>
    <artifactId>opentracing-sparkjava</artifactId>
    <version>1.0.1</version>
</dependency>
// https://jarcasting.com/artifacts/com.mikelduke/opentracing-sparkjava/
implementation 'com.mikelduke:opentracing-sparkjava:1.0.1'
// https://jarcasting.com/artifacts/com.mikelduke/opentracing-sparkjava/
implementation ("com.mikelduke:opentracing-sparkjava:1.0.1")
'com.mikelduke:opentracing-sparkjava:jar:1.0.1'
<dependency org="com.mikelduke" name="opentracing-sparkjava" rev="1.0.1">
  <artifact name="opentracing-sparkjava" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.mikelduke', module='opentracing-sparkjava', version='1.0.1')
)
libraryDependencies += "com.mikelduke" % "opentracing-sparkjava" % "1.0.1"
[com.mikelduke/opentracing-sparkjava "1.0.1"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.sparkjava : spark-core jar 2.7.2
io.opentracing : opentracing-api jar 0.31.0
io.opentracing : opentracing-util jar 0.31.0

test (3)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12
io.jaegertracing : jaeger-core jar 0.28.0
com.squareup.okhttp3 : okhttp jar 3.9.0

Модули Проекта

Данный проект не имеет модулей.

Maven Central OpenTracing Badge License

opentracing-sparkjava

OpenTracing Instrumentation for SparkJava

This repo contains tracing filters and an exception handler for SparkJava. The filters extract tracing headers from incoming requests to create OpenTracing spans. These spans can be exported to a variety of backends including Jaeger, Hawkular, and others.

Dependencies

The Spark dependency is marked as compileOnly and must be supplied by the application.

compile group: 'com.sparkjava', name: 'spark-core', version: '2.7.+'

Usage

To enable tracing you need to add before, exception and afterAfter hooks:

OpenTracingSparkFilters sparkTracingFilters = new OpenTracingSparkFilters(tracer);
Spark.before(sparkTracingFilters.before());
Spark.afterAfter(sparkTracingFilters.afterAfter());
Spark.exception(sparkTracingFilters.exception());

// tracing is added for all routes
Spark.get("/hello", (req, res) -> "hello world");

To access the current span in a resource retrieve it from the request attributes using OpenTracingSparkFilters.SERVER_SPAN:

Spark.get("/path", (req, res) -> {
    Span span = req.attribute(OpenTracingSparkFilters.SERVER_SPAN);
    tracer.buildSpan("child").asChildOf(span).withTag("test", "value").start().finish();

    //do stuff
    return "hello world";
});

Версии библиотеки

Версия
1.0.1