Skip to content

Commit d93599e

Browse files
authored
uninstrument spans that are performed in memory (usually 3-4us) (#1014)
* uninstrument spans that are performed in memory (usually 3-4us) * instrument actual storage calls
1 parent 00a166b commit d93599e

File tree

5 files changed

+7
-6
lines changed

5 files changed

+7
-6
lines changed

app-server/src/storage/s3.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use anyhow::Result;
22
use async_trait::async_trait;
33
use aws_sdk_s3::Client;
44
use std::{pin::Pin, sync::Arc};
5+
use tracing::instrument;
56

67
use crate::{
78
mq::{MessageQueue, MessageQueueTrait},
@@ -53,6 +54,7 @@ impl super::StorageTrait for S3Storage {
5354
Ok(self.get_url(key))
5455
}
5556

57+
#[instrument(skip(self, data))]
5658
async fn store_direct(&self, bucket: &str, key: &str, data: Vec<u8>) -> Result<String> {
5759
// Direct storage method used by the payload worker
5860
self.client

app-server/src/traces/consumer.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,11 @@ async fn process_batch(
368368
send_trace_updates(&updated_traces, &sse_connections).await;
369369
}
370370
Err(e) => {
371-
log::error!("Failed to upsert trace statistics to PostgreSQL: {:?}", e);
371+
log::error!(
372+
"Failed to upsert trace statistics to PostgreSQL. project_id: [{}], error: [{:?}]",
373+
project_id,
374+
e
375+
);
372376
}
373377
}
374378
}

app-server/src/traces/provider/mod.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,12 @@ mod langchain;
22
mod openai;
33

44
use serde_json::Value;
5-
use tracing::instrument;
65

76
use crate::{
87
db::spans::{Span, SpanType},
98
traces::provider::langchain::is_langchain_span,
109
};
1110

12-
#[instrument(skip(span))]
1311
pub fn convert_span_to_provider_format(span: &mut Span) {
1412
if span.span_type != SpanType::LLM {
1513
return;

app-server/src/traces/spans.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ use indexmap::IndexMap;
1010
use regex::Regex;
1111
use serde::{Deserialize, Serialize};
1212
use serde_json::{Value, json};
13-
use tracing::instrument;
1413
use uuid::Uuid;
1514

1615
use crate::{
@@ -754,7 +753,6 @@ impl Span {
754753
}
755754
}
756755

757-
#[instrument(skip(self, project_id, storage))]
758756
pub async fn store_payloads(&mut self, project_id: &Uuid, storage: Arc<Storage>) -> Result<()> {
759757
let payload_size_threshold = env::var("MAX_DB_SPAN_PAYLOAD_BYTES")
760758
.ok()

app-server/src/traces/utils.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,6 @@ fn is_top_span(span: &Span, attributes: &SpanAttributes) -> bool {
123123
first_in_ids && first_in_path
124124
}
125125

126-
#[instrument(skip(span, span_usage, events))]
127126
pub fn prepare_span_for_recording(span: &mut Span, span_usage: &SpanUsage, events: &[Event]) -> () {
128127
events.iter().for_each(|event| {
129128
// Check if it's an exception event

0 commit comments

Comments
 (0)