haystack

Форк
0
/
opentelemetry-tracer-33d44eb125a3145b.yaml 
39 строк · 1.8 Кб
1
---
2
features:
3
  - |
4
    Added out-of-the-box support for the OpenTelemetry Tracer. This allows you to instrument pipeline and component
5
    runs using OpenTelemetry and send traces to your preferred backend.
6

7
    To use the OpenTelemetry Tracer you need to have the `opentelemetry-sdk` package installed in your environment.
8
    To instruct Haystack to use the OpenTelemetry Tracer, you have multiple options:
9

10
    * Run your Haystack application using the `opentelemetry-instrument` command line tool as described in the
11
     [OpenTelemetry documentation](https://opentelemetry.io/docs/languages/python/automatic/#configuring-the-agent).
12
      This behavior can be disabled by setting the `HAYSTACK_AUTO_TRACE_ENABLED_ENV_VAR` environment variable to `false`.
13
    * Configure the tracer manually in your code using the `opentelemetry` package:
14
      ```python
15
      from opentelemetry import trace
16
      from opentelemetry.exporter.otlp.proto.http.trace_exporter import OTLPSpanExporter
17
      from opentelemetry.sdk.trace import TracerProvider
18
      from opentelemetry.sdk.trace.export import BatchSpanProcessor
19

20
      # Service name is required for most backends
21
      resource = Resource(attributes={
22
          SERVICE_NAME: "haystack"
23
      })
24

25
      traceProvider = TracerProvider(resource=resource)
26
      processor = BatchSpanProcessor(OTLPSpanExporter(endpoint="http://localhost:4318/v1/traces"))
27
      traceProvider.add_span_processor(processor)
28
      trace.set_tracer_provider(traceProvider)
29

30
      # Auto-configuration
31
      import haystack.tracing
32
      haystack.tracing.auto_enable_tracing()
33

34
      # Or explicitly
35
      from haystack.tracing import OpenTelemetryTracer
36

37
      tracer = traceProvider.get_tracer("my_application")
38
      tracing.enable_tracing(OpenTelemetryTracer(tracer))
39
      ```
40

Использование cookies

Мы используем файлы cookie в соответствии с Политикой конфиденциальности и Политикой использования cookies.

Нажимая кнопку «Принимаю», Вы даете АО «СберТех» согласие на обработку Ваших персональных данных в целях совершенствования нашего веб-сайта и Сервиса GitVerse, а также повышения удобства их использования.

Запретить использование cookies Вы можете самостоятельно в настройках Вашего браузера.