MCPcopy Create free account
hub / github.com/NodeDB-Lab/nodedb / emit

Method emit

nodedb/src/control/trace_export.rs:105–143  ·  view source on GitHub ↗
(
        self: &Arc<Self>,
        span_name: &'static str,
        trace_id: nodedb_types::TraceId,
        start: SystemTime,
        end: SystemTime,
        tenant_id: u64,
        vshard_id: u32

Source from the content-addressed store, hash-verified

103 ///
104 #[allow(clippy::too_many_arguments)]
105 pub fn emit(
106 self: &Arc<Self>,
107 span_name: &'static str,
108 trace_id: nodedb_types::TraceId,
109 start: SystemTime,
110 end: SystemTime,
111 tenant_id: u64,
112 vshard_id: u32,
113 status_ok: bool,
114 ) {
115 if !self.is_enabled() {
116 return;
117 }
118 let endpoint = self.endpoint.clone();
119 // `is_enabled` above guarantees `client` is Some.
120 let Some(client) = self.client.clone() else {
121 return;
122 };
123 let timeout = self.timeout;
124 let start_ns = system_time_to_unix_nanos(start);
125 let end_ns = system_time_to_unix_nanos(end);
126 tokio::spawn(async move {
127 crate::control::otel::exporter::export_span(
128 &client,
129 timeout,
130 &crate::control::otel::exporter::SpanExport {
131 endpoint: &endpoint,
132 trace_id,
133 span_name,
134 start_ns,
135 end_ns,
136 tenant_id,
137 vshard_id,
138 status_ok,
139 },
140 )
141 .await;
142 });
143 }
144}
145
146fn system_time_to_unix_nanos(t: SystemTime) -> u64 {

Callers 2

execute_planMethod · 0.45
disabled_is_noopFunction · 0.45

Calls 5

export_spanFunction · 0.85
spawnFunction · 0.50
is_enabledMethod · 0.45
cloneMethod · 0.45

Tested by 1

disabled_is_noopFunction · 0.36