Tracing: DAO layer + handler spans on tracing, drop all Context params (#141)
trace_db_call no longer takes an OpenTelemetry Context: it opens a db.<query_type>.<operation> span (same name via otel.name, same db.query_type / db.operation attrs) on the caller's ambient tracing span and runs the DAO body inside it. The cx / ctx / context parameter is gone from every DAO trait method, impl and call site, and from the helpers and background drains that only threaded it. The remaining request-handler spans (files, tags, faces, image, video, favorites, duplicates, memories) move to #[instrument]; the Context::current_with_span / with_remote_span_context plumbing is gone, as is extract_context_from_request (the tracing-actix-web root span covers it). otel::set_span_attributes replaces BoxedSpan::set_attributes. Background-job raw spans (thumbnails, video actors) are left for #142. tests/otel_db_spans.rs pins name, attributes, status and nesting (across an instrumented spawn); otel_traceparent now uses an #[instrument] handler. CLAUDE.md documents the tracing conventions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
1c508cdabd
commit
b6deca2a52
55 files changed
+1942
-3852
No files matched your search
+3
-18
@@ -93,12 +93,7 @@ impl TestPreviewDao {
|
||||
}
|
||||
|
||||
impl PreviewDao for TestPreviewDao {
|
||||
fn insert_preview(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
file_path_val: &str,
|
||||
status_val: &str,
|
||||
) -> Result<(), DbError> {
|
||||
fn insert_preview(&mut self, file_path_val: &str, status_val: &str) -> Result<(), DbError> {
|
||||
let mut clips = self.clips.lock().unwrap();
|
||||
// insert_or_ignore semantics: skip if key already exists
|
||||
if clips.contains_key(file_path_val) {
|
||||
@@ -126,7 +121,6 @@ impl PreviewDao for TestPreviewDao {
|
||||
|
||||
fn update_status(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
file_path_val: &str,
|
||||
status_val: &str,
|
||||
duration: Option<f32>,
|
||||
@@ -149,17 +143,12 @@ impl PreviewDao for TestPreviewDao {
|
||||
}
|
||||
}
|
||||
|
||||
fn get_preview(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
file_path_val: &str,
|
||||
) -> Result<Option<VideoPreviewClip>, DbError> {
|
||||
fn get_preview(&mut self, file_path_val: &str) -> Result<Option<VideoPreviewClip>, DbError> {
|
||||
Ok(self.clips.lock().unwrap().get(file_path_val).cloned())
|
||||
}
|
||||
|
||||
fn get_previews_batch(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
file_paths: &[String],
|
||||
) -> Result<Vec<VideoPreviewClip>, DbError> {
|
||||
let clips = self.clips.lock().unwrap();
|
||||
@@ -169,11 +158,7 @@ impl PreviewDao for TestPreviewDao {
|
||||
.collect())
|
||||
}
|
||||
|
||||
fn get_by_status(
|
||||
&mut self,
|
||||
_context: &opentelemetry::Context,
|
||||
status_val: &str,
|
||||
) -> Result<Vec<VideoPreviewClip>, DbError> {
|
||||
fn get_by_status(&mut self, status_val: &str) -> Result<Vec<VideoPreviewClip>, DbError> {
|
||||
let clips = self.clips.lock().unwrap();
|
||||
Ok(clips
|
||||
.values()
|
||||
|
||||
Reference in new issue
Block a user