Liking cljdoc? Tell your friends :D

steffan-westcott.clj-otel.sdk.otel-sdk

Programmatic configuration of the OpenTelemetry SDK.

Programmatic configuration of the OpenTelemetry SDK.
raw docstring

close-otel-sdk!clj

(close-otel-sdk!)

Shut down activities of OpenTelemetrySdk instance previously configured by init-otel-sdk!.

Shut down activities of `OpenTelemetrySdk` instance previously configured
by [[init-otel-sdk!]].
sourceraw docstring

init-otel-sdk!clj

(init-otel-sdk! service-name
                {:keys [resources tracer-provider propagators]
                 :or {propagators [(w3c-trace/w3c-trace-context-propagator)
                                   (w3c-baggage/w3c-baggage-propagator)]}})

Configure an OpenTelemetrySdk instance and set as the global OpenTelemetry instance. service-name is the service name given to the resource emitting telemetry. This function may be evaluated once only. Attempts to evaluate this more than once will result in error.

Takes a nested option map as described in the following sections. Some options can take either an option map or an equivalent fully configured Java object.

Top level option map

keydescription
:resourcesCollection of resources to merge with default SDK resource and service-name resource. Each resource in the collection is either a Resource instance or a map with keys :attributes (required) and :schema-url (optional). The merged resource describes the source of telemetry and is attached to emitted data (default: nil)
:tracer-providerRequired options map (see below) to configure SdkTracerProvider instance.
:propagatorsCollection of TextMapPropagator instances used to inject and extract context information using HTTP headers (default: W3C Trace Context and W3C Baggage text map propagators).

:tracer-provider option map

keydescription
:span-processorsCollection of option maps (see table below) or SpanProcessor instances. Each member specifies a collection of span exporters and batching to apply to those exporters (default: []).
:span-limitsOption map (see table below), SpanLimits, Supplier or fn which returns span limits (default: same as {}).
:samplerOption map (see table below) or Sampler instance, specifies strategy for sampling spans (default: same as {:parent-based {}}).
:id-generatorIdGenerator instance for generating ids for spans and traces (default: platform specific IdGenerator).
:clockClock instance used for time reading operations (default: system clock).

:span-processors member option map

keydescription
:exportersCollection of SpanExporter instances, used to export spans to processing and reporting backends.
:batch?If true, batches spans for export. If false then export spans individually; generally meant for debug logging exporters only. All options other than :exporters are ignored when :batch is false (default: true).
:schedule-delayDelay interval between consecutive batched exports. Value is either a Duration or a vector [amount ^TimeUnit unit] (default: 5000ms).
:exporter-timeoutMaximum time a batched export will be allowed to run before being cancelled. Value is either a Duration or a vector [amount ^TimeUnit unit] (default: 30000ms).
:max-queue-sizeMaximum number of spans kept in queue before start dropping (default: 2048).
:max-export-batch-sizeMaximum batch size for every export, must be smaller or equal to :max-queue-size (default: 512).

:span-limits option map

keydescription
:max-attrsMaximum number of attributes per span (default: 128).
:max-eventsMaximum number of events per span (default: 128).
:max-linksMaximum number of links per span (default: 128).
:max-attrs-per-eventMaximum number of attributes per event (default: 128).
:max-attrs-per-linkMaximum number of attributes per link (default: 128).
:max-attr-value-lenMaximum length of string attribute values and each element of string array attribute values (default: no maximum).

:sampler option map (one option only)

keydescription
:alwaysWith value :on always record and export all spans. With value :off drop all spans.
:ratiodouble in range [0.0, 1.0], describing the ratio of spans to be sampled.
:parent-basedOption map (see table below), describing sampling decisions based on the parent span.

:parent-based option map

keydescription
:rootOption map (see :sampler table above) or Sampler to use when no parent span is present (default: same as {:always :on}).
:remote-parent-sampledOption map (see :sampler table above) or Sampler to use when there is a remote parent that was sampled (default: same as {:always :on}).
:remote-parent-not-sampledOption map (see :sampler table above) or Sampler to use when there is a remote parent that was not sampled (default: same as {:always :off}).
:local-parent-sampledOption map (see :sampler table above) or Sampler to use when there is a local parent that was sampled (default: same as {:always :on}).
:local-parent-not-sampledOption map (see :sampler table above) or Sampler to use when there is a local parent that was not sampled (default: same as {:always :off}).
Configure an `OpenTelemetrySdk` instance and set as the global
`OpenTelemetry` instance. `service-name` is the service name given to the
resource emitting telemetry. This function may be evaluated once only.
Attempts to evaluate this more than once will result in error.

Takes a nested option map as described in the
following sections. Some options can take either an option map or an
equivalent fully configured Java object.

Top level option map

| key              | description |
|------------------|-------------|
|`:resources`      | Collection of resources to merge with default SDK resource and `service-name` resource. Each resource in the collection is either a `Resource` instance or a map with keys `:attributes` (required) and `:schema-url` (optional). The merged resource describes the source of telemetry and is attached to emitted data (default: nil)
|`:tracer-provider`| Required options map (see below) to configure `SdkTracerProvider` instance.
|`:propagators`    | Collection of `TextMapPropagator` instances used to inject and extract context information using HTTP headers (default: W3C Trace Context and W3C Baggage text map propagators).

`:tracer-provider` option map

| key              | description |
|------------------|-------------|
|`:span-processors`| Collection of option maps (see table below) or `SpanProcessor` instances. Each member specifies a collection of span exporters and batching to apply to those exporters (default: `[]`).
|`:span-limits`    | Option map (see table below), `SpanLimits`, `Supplier` or fn which returns span limits (default: same as `{}`).
|`:sampler`        | Option map (see table below) or `Sampler` instance, specifies strategy for sampling spans (default: same as `{:parent-based {}}`).
|`:id-generator`   | `IdGenerator` instance for generating ids for spans and traces (default: platform specific `IdGenerator`).
|`:clock`          | `Clock` instance used for time reading operations (default: system clock).

`:span-processors` member option map

| key                    | description |
|------------------------|-------------|
|`:exporters`            | Collection of `SpanExporter` instances, used to export spans to processing and reporting backends.
|`:batch?`               | If true, batches spans for export. If false then export spans individually; generally meant for debug logging exporters only. All options other than `:exporters` are ignored when `:batch` is false (default: `true`).
|`:schedule-delay`       | Delay interval between consecutive batched exports. Value is either a `Duration` or a vector `[amount ^TimeUnit unit]` (default: 5000ms).
|`:exporter-timeout`     | Maximum time a batched export will be allowed to run before being cancelled. Value is either a `Duration` or a vector `[amount ^TimeUnit unit]` (default: 30000ms).
|`:max-queue-size`       | Maximum number of spans kept in queue before start dropping (default: 2048).
|`:max-export-batch-size`| Maximum batch size for every export, must be smaller or equal to `:max-queue-size` (default: 512).

`:span-limits` option map

| key                  | description |
|----------------------|-------------|
|`:max-attrs`          | Maximum number of attributes per span (default: 128).
|`:max-events`         | Maximum number of events per span (default: 128).
|`:max-links`          | Maximum number of links per span (default: 128).
|`:max-attrs-per-event`| Maximum number of attributes per event (default: 128).
|`:max-attrs-per-link` | Maximum number of attributes per link (default: 128).
|`:max-attr-value-len` | Maximum length of string attribute values and each element of string array attribute values (default: no maximum).

`:sampler` option map (one option only)

| key           | description |
|---------------|-------------|
|`:always`      | With value `:on` always record and export all spans. With value `:off` drop all spans.
|`:ratio`       | double in range [0.0, 1.0], describing the ratio of spans to be sampled.
|`:parent-based`| Option map (see table below), describing sampling decisions based on the parent span.

`:parent-based` option map

| key                        | description |
|----------------------------|-------------|
|`:root`                     | Option map (see `:sampler` table above) or `Sampler` to use when no parent span is present (default: same as `{:always :on}`).
|`:remote-parent-sampled`    | Option map (see `:sampler` table above) or `Sampler` to use when there is a remote parent that was sampled (default: same as `{:always :on}`).
|`:remote-parent-not-sampled`| Option map (see `:sampler` table above) or `Sampler` to use when there is a remote parent that was not sampled (default: same as `{:always :off}`).
|`:local-parent-sampled`     | Option map (see `:sampler` table above) or `Sampler` to use when there is a local parent that was sampled (default: same as `{:always :on}`).
|`:local-parent-not-sampled` | Option map (see `:sampler` table above) or `Sampler` to use when there is a local parent that was not sampled (default: same as `{:always :off}`).
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close