OpenTracing Instrumentation for Elasticsearch 5 Client


Лицензия

Лицензия

Категории

Категории

CLI Взаимодействие с пользователем Search Прикладные библиотеки Elasticsearch
Группа

Группа

io.opentracing.contrib
Идентификатор

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

opentracing-elasticsearch-client-common
Последняя версия

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

0.1.6
Дата

Дата

Тип

Тип

jar
Описание

Описание

OpenTracing Instrumentation for Elasticsearch 5 Client
OpenTracing Instrumentation for Elasticsearch 5 Client

Скачать opentracing-elasticsearch-client-common

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

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

Зависимости

compile (1)

Идентификатор библиотеки Тип Версия
io.opentracing : opentracing-util jar 0.33.0

provided (1)

Идентификатор библиотеки Тип Версия
org.elasticsearch.client : transport jar 5.6.16

test (4)

Идентификатор библиотеки Тип Версия
org.apache.logging.log4j : log4j-api jar 2.11.1
org.apache.logging.log4j : log4j-core jar 2.11.1
io.opentracing : opentracing-mock jar 0.33.0
junit : junit jar 4.12

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

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

Build Status Coverage Status Released Version Apache-2.0 license

OpenTracing Elasticsearch Client Instrumentation

OpenTracing instrumentation for Elasticsearch clients.

Installation

Maven

pom.xml

Elasticsearch 5

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-elasticsearch5-client</artifactId>
    <version>VERSION</version>
</dependency>

Elasticsearch 6

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-elasticsearch6-client</artifactId>
    <version>VERSION</version>
</dependency>

Elasticsearch 7

<dependency>
    <groupId>io.opentracing.contrib</groupId>
    <artifactId>opentracing-elasticsearch7-client</artifactId>
    <version>VERSION</version>
</dependency>

Usage

// Instantiate tracer
Tracer tracer = ...

// Optionally register tracer with GlobalTracer
GlobalTracer.register(tracer);

// Build TransportClient with TracingPreBuiltTransportClient
TransportClient transportClient = new TracingPreBuiltTransportClient(settings)
                .addTransportAddress(...));

// Build RestClient adding TracingHttpClientConfigCallback
 RestClient restClient = RestClient.builder(
                new HttpHost(...))
                .setHttpClientConfigCallback(new TracingHttpClientConfigCallback(tracer))
                .build();

Custom Span Names with the TracingHttpClientConfigCallback

This driver includes support for customizing the spans created using the TracingHttpClientConfigCallback. You can use the predefined ones listed further below, or write your own in the form of a Function object.

// Create a Function for the TracingHttpClientConfigCallback that operates on
// the HttpRequest and returns a String that will be used as the Span name.
Function<HttpRequest, String> customSpanNameProvider =
  (request) -> request.getRequestLine().getMethod().toLowerCase();

// Build RestClient adding TracingHttpClientConfigCallback
 RestClient restClient = RestClient.builder(
                new HttpHost(...))
                .setHttpClientConfigCallback(new TracingHttpClientConfigCallback(tracer, customSpanNameProvider))
                .build();
 
 // Spans created by the restClient will now have the request's lowercase method name as the span name.
 // "POST" -> "post"

Predefined Span Name Providers

The following Functions are already included in the ClientSpanNameProvider class, with REQUEST_METHOD_NAME being the default should no other span name provider be provided.

  • REQUEST_METHOD_NAME: Returns the HTTP method of the request.
    • GET /twitter/tweet/1?routing=user1 -> "GET"
  • PREFIXED_REQUEST_METHOD_NAME(String prefix): Returns a String concatenation of prefix and the HTTP method of the request.
    • GET /twitter/tweet/1?routing=user1 -> prefix + "GET"
  • REQUEST_TARGET_NAME: Returns the Elasticsearch target of the request, i.e. the index and resource it's operating on. IDs and other numbers not part of names will be replaced with a "?" to avoid overly granular names.
    • GET /twitter/tweet/1?routing=user1 -> "/twitter/tweet/?"
  • PREFIXED_REQUEST_TARGET_NAME(String prefix): Returns a String concatenation of prefix and the Elasticsearch target of the request. IDs and other numbers not part of names will be replaced with a "?" to avoid overly granular names.
    • GET /twitter/tweet/1?routing=user1 -> prefix + "/twitter/tweet/?"
  • REQUEST_METHOD_TARGET_NAME: Returns a String concatenation of the HTTP method of the request and the Elasticsearch target of the request. IDs and other numbers not part of names will be replaced with a "?" to avoid overly granular names.
    • GET /twitter/tweet/1?routing=user1 -> "GET /twitter/tweet/?"
  • PREFIXED_REQUEST_METHOD_TARGET_NAME(String prefix): Returns a String concatenation of prefix, the HTTP method of the request, and the Elasticsearch target of the request. IDs and other numbers not part of names will be replaced with a "?" to avoid overly granular names.
    • GET /twitter/tweet/1?routing=user1 -> prefix + "GET /twitter/tweet/?"

License

Apache 2.0 License.

io.opentracing.contrib

3rd-Party OpenTracing API Contributions

3rd-party contributions that use OpenTracing. **The repositories in this org are *not* affiliated with the CNCF.**

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

Версия
0.1.6
0.1.5
0.1.4
0.1.3
0.1.2
0.1.1
0.1.0
0.0.7
0.0.6
0.0.5