diff --git a/CHANGELOG.md b/CHANGELOG.md index 52930a160a..53f06dbe6f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ "You know what they say. Fool me once, strike one, but fool me twice... strike three." — Michael Scott +## Unreleased + +### Various fixes & improvements + +- feat: Added the `--raw` flag to `send-envelope` to allow sending envelopes without parsing or validation. (#1468) + ## 2.12.0 ### Various fixes & improvements diff --git a/Cargo.lock b/Cargo.lock index 358ee0477b..c318537d51 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2164,9 +2164,9 @@ checksum = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" [[package]] name = "sentry" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6097dc270a9c4555c5d6222ed243eaa97ff38e29299ed7c5cb36099033c604e" +checksum = "c6f8ce69326daef9d845c3fd17149bd3dbd7caf5dc65dbbad9f5441a40ee407f" dependencies = [ "curl", "httpdate", @@ -2177,9 +2177,9 @@ dependencies = [ [[package]] name = "sentry-anyhow" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45a52d909ea1f5107fe29aa86581da01b88bde811fbde875773237c1596fbab6" +checksum = "a80510663e6b711de2eed521a95dc38435a0e5858397d1acec79185e4a44215b" dependencies = [ "anyhow", "sentry-backtrace", @@ -2188,9 +2188,9 @@ dependencies = [ [[package]] name = "sentry-backtrace" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d92d1e4d591534ae4f872d6142f3b500f4ffc179a6aed8a3e86c7cc96d10a6a" +checksum = "3ed6c0254d4cce319800609aa0d41b486ee57326494802045ff27434fc9a2030" dependencies = [ "backtrace", "once_cell", @@ -2270,9 +2270,9 @@ dependencies = [ [[package]] name = "sentry-contexts" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afa877b1898ff67dd9878cf4bec4e53cef7d3be9f14b1fc9e4fcdf36f8e4259" +checksum = "d3277dc5d2812562026f2095c7841f3d61bbe6789159b7da54f41d540787f818" dependencies = [ "hostname", "libc", @@ -2284,9 +2284,9 @@ dependencies = [ [[package]] name = "sentry-core" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc43eb7e4e3a444151a0fe8a0e9ce60eabd905dae33d66e257fa26f1b509c1bd" +checksum = "b5acbd3da4255938cf0384b6b140e6c07ff65919c26e4d7a989d8d90ee88fa91" dependencies = [ "once_cell", "rand", @@ -2297,9 +2297,9 @@ dependencies = [ [[package]] name = "sentry-types" -version = "0.29.2" +version = "0.29.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f63708ec450b6bdcb657af760c447416d69c38ce421f34e5e2e9ce8118410bc7" +checksum = "10d8587b12c0b8211bb3066979ee57af6e8657e23cf439dc6c8581fd86de24e8" dependencies = [ "debugid", "getrandom", diff --git a/Cargo.toml b/Cargo.toml index 6e284d5a78..86369d42cf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,7 +52,7 @@ regex = "1.7.1" runas = "0.2.1" rust-ini = "0.18.0" semver = "1.0.16" -sentry = { version = "0.29.2", default-features = false, features = [ +sentry = { version = "0.29.3", default-features = false, features = [ "anyhow", "curl", "contexts", diff --git a/src/commands/send_envelope.rs b/src/commands/send_envelope.rs index 0dc32bce28..aafd07398f 100644 --- a/src/commands/send_envelope.rs +++ b/src/commands/send_envelope.rs @@ -26,6 +26,11 @@ pub fn make_command(command: Command) -> Command { .required(true) .help("The path or glob to the file(s) in envelope format to send as envelope(s)."), ) + .arg( + Arg::new("raw") + .long("raw") + .help("Send envelopes without attempting to parse their contents."), + ) } fn send_raw_envelope(envelope: Envelope, dsn: Dsn) { @@ -36,6 +41,7 @@ fn send_raw_envelope(envelope: Envelope, dsn: Dsn) { pub fn execute(matches: &ArgMatches) -> Result<()> { let config = Config::current(); let dsn = config.get_dsn()?; + let raw = matches.is_present("raw"); let path = matches.value_of("path").unwrap(); @@ -51,7 +57,11 @@ pub fn execute(matches: &ArgMatches) -> Result<()> { for path in collected_paths { let p = path.as_path(); - let envelope: Envelope = Envelope::from_path(p)?; + let envelope: Envelope = if raw { + Envelope::from_path_raw(p) + } else { + Envelope::from_path(p) + }?; send_raw_envelope(envelope, dsn.clone()); println!("Envelope from file {} dispatched", p.display()); } diff --git a/tests/integration/_cases/send_envelope/send_envelope-file-log.trycmd b/tests/integration/_cases/send_envelope/send_envelope-file-log.trycmd index 942f87e450..ca747f6ecf 100644 --- a/tests/integration/_cases/send_envelope/send_envelope-file-log.trycmd +++ b/tests/integration/_cases/send_envelope/send_envelope-file-log.trycmd @@ -3,7 +3,7 @@ $ sentry-cli send-envelope tests/integration/_fixtures/envelope.dat --log-level= ? success DEBUG [..] sentry-cli version: [VERSION], platform: [..], architecture: [..] INFO [..] sentry-cli was invoked with the following command line: "[CWD]/target/debug/sentry-cli[EXE]" "send-envelope" "tests/integration/_fixtures/envelope.dat" "--log-level=debug" - DEBUG [..] Envelope { event_id: Some(22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c), items: [Event(Event { event_id: 22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c, level: Error, fingerprint: ["{{ default }}"], culprit: None, transaction: None, message: None, logentry: None, logger: None, modules: {}, platform: "other", timestamp: [..], server_name: None, release: None, dist: None, environment: None, user: None, request: None, contexts: {}, breadcrumbs: Values { values: [] }, exception: Values { values: [] }, stacktrace: None, template: None, threads: Values { values: [] }, tags: {}, extra: {}, debug_meta: DebugMeta { sdk_info: None, images: [] }, sdk: None }), Transaction(Transaction { event_id: 22d00b3f-d1b1-4b5d-8d20-49d138cd8a9d, name: None, release: None, environment: None, tags: {}, extra: {}, sdk: None, platform: "other", timestamp: None, start_timestamp: [..], spans: [Span { span_id: SpanId([212, 44, 238, 159, 195, 231, 79, 92]), trace_id: TraceId([51, 94, 83, 214, 20, 71, 74, 204, 159, 137, 230, 50, 183, 118, 204, 40]), parent_span_id: None, same_process_as_parent: None, op: None, description: None, timestamp: None, start_timestamp: [..], status: None, tags: {}, data: {} }], contexts: {}, request: None, active_thread_id: None }), SessionUpdate(SessionUpdate { session_id: 22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c, distinct_id: Some("foo@bar.baz"), sequence: None, timestamp: None, started: [..], init: true, duration: Some(1.234), status: Ok, errors: 123, attributes: SessionAttributes { release: "foo-bar@1.2.3", environment: Some("production"), ip_address: None, user_agent: None } }), Attachment(Attachment { buffer: 12, filename: "file.txt", content_type: Some("application/octet-stream"), type: Some(Attachment) })] } + DEBUG [..] Envelope { event_id: Some(22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c), items: EnvelopeItems([Event(Event { event_id: 22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c, level: Error, fingerprint: ["{{ default }}"], culprit: None, transaction: None, message: None, logentry: None, logger: None, modules: {}, platform: "other", timestamp: [..], server_name: None, release: None, dist: None, environment: None, user: None, request: None, contexts: {}, breadcrumbs: Values { values: [] }, exception: Values { values: [] }, stacktrace: None, template: None, threads: Values { values: [] }, tags: {}, extra: {}, debug_meta: DebugMeta { sdk_info: None, images: [] }, sdk: None }), Transaction(Transaction { event_id: 22d00b3f-d1b1-4b5d-8d20-49d138cd8a9d, name: None, release: None, environment: None, tags: {}, extra: {}, sdk: None, platform: "other", timestamp: None, start_timestamp: [..], spans: [Span { span_id: SpanId([212, 44, 238, 159, 195, 231, 79, 92]), trace_id: TraceId([51, 94, 83, 214, 20, 71, 74, 204, 159, 137, 230, 50, 183, 118, 204, 40]), parent_span_id: None, same_process_as_parent: None, op: None, description: None, timestamp: None, start_timestamp: [..], status: None, tags: {}, data: {} }], contexts: {}, request: None, active_thread_id: None }), SessionUpdate(SessionUpdate { session_id: 22d00b3f-d1b1-4b5d-8d20-49d138cd8a9c, distinct_id: Some("foo@bar.baz"), sequence: None, timestamp: None, started: [..], init: true, duration: Some(1.234), status: Ok, errors: 123, attributes: SessionAttributes { release: "foo-bar@1.2.3", environment: Some("production"), ip_address: None, user_agent: None } }), Attachment(Attachment { buffer: 12, filename: "file.txt", content_type: Some("application/octet-stream"), type: Some(Attachment) })]) } Envelope from file tests/integration/_fixtures/envelope.dat dispatched ``` diff --git a/tests/integration/_cases/send_envelope/send_envelope-help.trycmd b/tests/integration/_cases/send_envelope/send_envelope-help.trycmd index ce105996b7..8e88e16261 100644 --- a/tests/integration/_cases/send_envelope/send_envelope-help.trycmd +++ b/tests/integration/_cases/send_envelope/send_envelope-help.trycmd @@ -36,4 +36,7 @@ OPTIONS: [aliases: silent] + --raw + Send envelopes without attempting to parse their contents. + ```