1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
//! Server-side composer extension for the unified observability pipeline.
//!
//! Core deliberately has no `prometheus` / `opentelemetry` dependencies,
//! so server-only hooks cannot ride on
//! [`surrealdb_core::observe::ObservabilityProvider`]. The server crate
//! therefore exposes its own [`ObservabilityProvider`] trait that
//! supertraits the core one and adds optional accessors used by the unified
//! `SdkMeterProvider` setup at startup. Every method defaults to [`None`]
//! so community composers (and any external composer pre-dating these
//! methods) keep working unchanged.
use Arc;
use CommunityComposer;
use ExecutionObserver;
use ObservabilityRuntime;
/// Read-only view of a record-pipeline's queue counters, exposed through
/// the unified [`opentelemetry_sdk::metrics::SdkMeterProvider`] as
/// aggregate self-metrics.
///
/// Generic over the pipeline kind: the audit log and the slow-query log
/// both implement this so the same registration helper can be used for
/// both, parameterised by a metric-name prefix. Composers that don't run
/// any pipeline return `None` from
/// [`ObservabilityProvider::audit_counters`] /
/// [`ObservabilityProvider::slow_query_counters`] and the community
/// surface stays unchanged.
/// Server-side composer extension supertraiting the core
/// [`surrealdb_core::observe::ObservabilityProvider`].
///
/// Composers contribute optional pipeline-counter handles that the unified
/// meter provider registers as observable gauges. They also opt into the
/// runtime-aware observer hook
/// [`Self::create_observer_with_runtime`] when their observers need to
/// register instruments or claim audit-log scopes; the default
/// implementation delegates to the core
/// [`surrealdb_core::observe::ObservabilityProvider::create_observer`]
/// for community composers that have no enterprise instruments to
/// register.