Library used by Electric to gather telemetry and export it to a number of supported destinations. Originally extracted from electric-sql/electric.
Install it by adding electric_telemetry to your list of dependencies in mix.exs:
def deps do
[
{:electric_telemetry, github: "electric-sql/electric-telemetry"}
]
endTelemetry must be enabled at compile time by placing the following line in your app's config/config.exs file:
config :electric_telemetry, enabled?: trueRuntime configuration can partially be done via app env
config :electric_telemetry,
otel_opts: [
otlp_endpoint: "...",
otlp_headers: %{...}
resource: %{...}
]but the majority of the supported configuration options are passed as keyword list to either Electric.Telemetry.ApplicationTelemetry or Electric.Telemetry.StackTelemetry. See Electric.Telemetry.Opts for the supported options.
At a high level, the library includes these modules:
-
Electric.Telemetryas the top-level interface for determining whether telemetry collection and/or export is enabled. Defines macros that are used to conditionally compile other collecting and exporting modules. -
Electric.Telemetry.ApplicationTelemetrydefines metrics and periodic measurements that apply to BEAM as a whole. -
Electric.Telemetry.StackTelemetrydefines metrics that are specific to the notion of an Electric stack: shape stats, replication client stats, etc. No builtin measurements are defines here. -
Reporter modules. These are enabled individually and are used for exporting metrics to the corresponding destination.
-
Electric.Telemetry.Sentry. This is primarily used by the Electric app but a couple of modules in the electric-telemetry proper rely on it as well. Hence the inclusion of this module in the library.