当前位置:网站首页>Jaeger introduces native support for opentelemetry

Jaeger introduces native support for opentelemetry

2022-06-10 15:04:00 CNCF

author :Yuri Shkuro

Abreast of the times Jaeger v1.35 edition [1] Introduced through OpenTelemetry agreement (OTLP)[2] receive OpenTelemetry The ability to track data , all OpenTelemetry SDK Need to support this protocol . This is before Declare elimination Jaeger“ classic ” Client library [3] Subsequent to .

With this new feature , Will no longer be needed Jaeger Exporter and OpenTelemetry SDK Use it together , It's no longer necessary to be in Jaeger Back end running OpenTelemetry The collector . Use OTLP Exporter ,SDK Can be configured to send data directly to Jaeger Back end .OTLP Receiver pass gRPC or HTTP The endpoint accepts data .

Primer

Let's take a look at how this function works . First , according to Introduction to the document [4] The instructions in start Jaeger Integrated machine :

docker run --name jaeger \
  -e COLLECTOR_OTLP_ENABLED=true \
  -p 16686:16686 \
  -p 4317:4317 \
  -p 4318:4318 \
  jaegertracing/all-in-one:1.35

Please note that , Compared to previous versions :

  1. Two ports have also been added to the export list ,4317 and 4318,OTLP The receiver uses them to listen gRPC and HTTP Connect .
  2. OTLP The receiver must pass through COLLECTOR_OTLP_ENABLED=true Can make .
  3. We removed other ports that are not related to this example .

When Jaeger On backend startup , You should see these two lines of logs :

{... "msg":"Starting GRPC server on endpoint 0.0.0.0:4317"}
{... "msg":"Starting HTTP server on endpoint 0.0.0.0:4318"}

As usual ,Jaeger UI Can be in http://localhost:16686/ visit .

Now let's use a simple Python Program , It USES OTLPSpanExporter To configure OpenTelemetry SDK And generate a single span trace .

from opentelemetry import trace
from opentelemetry.sdk.trace import TracerProvider
from opentelemetry.sdk.trace.export import BatchSpanProcessor
from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter

trace.set_tracer_provider(TracerProvider())
trace.get_tracer_provider().add_span_processor(
    BatchSpanProcessor(OTLPSpanExporter())
)
tracer = trace.get_tracer(__name__)
with tracer.start_as_current_span("foo"):
    print("Hello world!")

basic_trace.py

opentelemetry-api
opentelemetry-sdk
opentelemetry-exporter-otlp-proto-http

requirements.txt

Run the program as follows :

pip install -r requirements.txt
OTEL_SERVICE_NAME=primer python3 basic_trace.py

If we refresh now Jaeger UI Search screen in , The services drop-down list should contain services primer( Please note that , We pass this service name to... Through the environment variable SDK), The trace from this service should look like this :

adopt OTLP Tracking of submitted samples .

OTLP The receiver can be accessed by --collector.otlp.* The multiple symbols at the beginning are further customized , These flags can be passed through the collector and all-in-one In the binary file help Command to get . These flags allow you to change two OTLP Port number of the server , To configure TLS, And change some other parameters , Such as maximum message size and keep alive .

Limit

The existing implementation has some considerations :

  • If your app uses OTLP Export tracking and metrics , Then you still need to run OpenTelemetry The collector , because Jaeger The collector can only accept OTLP The tracking part of the data . perhaps , You can use two that point to different back ends OTLP Exporter to configure SDK.
  • Jaeger The backend does not support OpenTelemetry Collector OTLP All options supported by the receiver .
  • Only Jaeger The collector supports new OTLP Receiver .Jaeger The agent only supports “ classic ”Jaeger Format . If your deployment requires a local agent , We recommend running OpenTelemetry The collector .

Reference material

[1]

Jaeger v1.35 edition : https://github.com/jaegertracing/jaeger/releases/tag/v1.35.0

[2]

OpenTelemetry agreement (OTLP): https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/protocol/otlp.md

[3]

Declare elimination Jaeger“ classic ” Client library : https://twitter.com/YuriShkuro/status/1455170693197402119

[4]

Introduction to the document : https://www.jaegertracing.io/docs/latest/getting-started/

[5]

The chat room : https://www.jaegertracing.io/get-in-touch/


CNCF (Cloud Native Computing Foundation) Founded on 2015 year 12 month , Affiliated to the Linux Foundation, It's a non-profit organization .

CNCF( Cloud native Computing Foundation ) Committed to fostering and maintaining a vendor neutral open source ecosystem , To promote cloud native technology . By democratizing the most cutting-edge model , Let these innovations be used by the public .

原网站

版权声明
本文为[CNCF]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/161/202206101443243417.html