package opentelemetry

  1. Overview
  2. Docs
Instrumentation for https://opentelemetry.io

Install

Dune Dependency

Authors

Maintainers

Sources

opentelemetry-0.11.1.tbz
sha256=0e289b62046daba6427d87276dba52c7d2adfc3d85723d29b3d97141ae522853
sha512=754ef48ee2883f5927dd0e6dcc28dfb2d8faee98be5952578f48515f58898063b6bc7a137bc68d9fbee2e5a8897c7af035e700e53ff202a6df79e74e1aeaf6d4

doc/opentelemetry.ambient-context/Opentelemetry_ambient_context/index.html

Module Opentelemetry_ambient_contextSource

Ambient context.

The ambient context, like the Matrix, is everywhere around you.

It is responsible for keeping track of that context in a manner that's consistent with the program's choice of control flow paradigm:

  • for synchronous/threaded/direct style code, TLS ("thread local storage") keeps track of a global variable per thread. Each thread has its own copy of the variable and updates it independently of other threads.
  • for Lwt, any 'a Lwt.t created inside the with_binding k v (fun _ -> …) will inherit the k := v assignment.
  • for Eio, fibers created inside with_binding k v (fun () -> …) will inherit the k := v assignment. This is consistent with the structured concurrency approach of Eio.

The only data stored by this storage is a Hmap.t, ie a heterogeneous map. Various users (libraries, user code, etc.) can create their own key to store what they are interested in, without affecting other parts of the storage.

module type STORAGE = Types.STORAGE
type storage = (module STORAGE)
Sourceval default_storage : storage
Sourceval get_current_storage : unit -> storage
Sourceval set_storage_provider : storage -> unit
Sourcetype 'a key

A key that can be mapped to values of type 'a in the ambient context.

Sourceval compare_key : int -> int -> int

Total order on keys

Sourceval create_key : unit -> 'a key

Create a new fresh key, distinct from any previously created key.

Sourceval get : 'a key -> 'a option

Get the current value for a given key, or None if no value was associated with the key in the ambient context.

Sourceval with_binding : 'a key -> 'a -> (unit -> 'r) -> 'r

with_binding k v cb calls cb() in a context in which k is bound to v. This does not affect storage outside of cb().

Sourceval without_binding : 'a key -> (unit -> 'b) -> 'b

without_binding k cb calls cb() in a context where k has no binding (possibly shadowing the current ambient binding of k if it exists).

OCaml

Innovation. Community. Security.