Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

log(replays): Add organization-id and project-id to log messages #3949

Merged
merged 4 commits into from
Aug 27, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions relay-server/src/services/processor/replay.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ use std::error::Error;
use std::net::IpAddr;

use bytes::Bytes;
use relay_base_schema::project::ProjectId;
use relay_dynamic_config::{Feature, GlobalConfig, ProjectConfig};
use relay_event_normalization::replay::{self, ReplayError};
use relay_event_normalization::RawUserAgentInfo;
Expand All @@ -28,6 +29,8 @@ pub fn process(
let replays_disabled = state.should_filter(Feature::SessionReplay);
let scrubbing_enabled = project_state.has_feature(Feature::SessionReplayRecordingScrubbing);
let replay_video_disabled = project_state.has_feature(Feature::SessionReplayVideoDisabled);
let project_id = project_state.project_id;
let organization_id = project_state.organization_id;

let meta = state.envelope().meta().clone();
let client_addr = meta.client_addr();
Expand Down Expand Up @@ -79,6 +82,8 @@ pub fn process(
global_config,
client_addr,
user_agent,
project_id,
organization_id,
)?;
item.set_payload(ContentType::Json, replay_event);
}
Expand All @@ -101,6 +106,8 @@ pub fn process(
user_agent,
scrubbing_enabled,
&mut scrubber,
project_id,
organization_id,
)?;
item.set_payload(ContentType::OctetStream, replay_video);
}
Expand All @@ -113,13 +120,16 @@ pub fn process(

// Replay Event Processing.

#[allow(clippy::too_many_arguments)]
fn handle_replay_event_item(
payload: Bytes,
event_id: &Option<EventId>,
config: &ProjectConfig,
global_config: &GlobalConfig,
client_ip: Option<IpAddr>,
user_agent: &RawUserAgentInfo<&str>,
project_id: Option<ProjectId>,
organization_id: Option<u64>,
) -> Result<Bytes, ProcessingError> {
let filter_settings = &config.filter_settings;

Expand Down Expand Up @@ -151,6 +161,8 @@ fn handle_replay_event_item(
relay_log::warn!(
error = &error as &dyn Error,
?event_id,
project_id = project_id.map(|v| v.value()),
organization_id = organization_id,
"invalid replay event"
);
Err(match error {
Expand Down Expand Up @@ -259,6 +271,8 @@ fn handle_replay_video_item(
user_agent: &RawUserAgentInfo<&str>,
scrubbing_enabled: bool,
scrubber: &mut RecordingScrubber,
project_id: Option<ProjectId>,
organization_id: Option<u64>,
) -> Result<Bytes, ProcessingError> {
let ReplayVideoEvent {
replay_event,
Expand All @@ -282,6 +296,8 @@ fn handle_replay_video_item(
global_config,
client_ip,
user_agent,
project_id,
organization_id,
)?;

// Process as a replay-recording envelope item.
Expand Down
Loading