Skip to content

Commit

Permalink
feat(ourlogs): Allow log ingestion behind a flag (#4448)
Browse files Browse the repository at this point in the history
This adds log ingestion (currently only working for the OTel log format)
behind a feature flag 'organizations:ourlogs-ingestion'.

This PR aims to be the minimum possible to support local and test-org
ingestion before we move to dogfooding.

![Screenshot 2025-01-15 at 1 26
49 PM](https://github.com/user-attachments/assets/45f0be20-05d8-45b4-988c-d00327fc2e9c)


Other notes:
- We need to add two `DataCategory`s because we need to track quantity
(for current discarded breadcrumb client outcome tracking) and also
bytes for total log bytes ingested, which is one of the quota
recommendations.
- Eventually we will convert Breadcrumbs into logs as well, very similar
to span extraction for spans on the event. How exactly that will work is
still being discussed with product and sdk folks.
- The name `ourlogs` is an internal name to disambiguate between 'our
log product' logs (corny, I know) and internally created logs. User
facing strings will be set to 'Log' to avoid exposing implementation
details.
- Depends on getsentry/sentry#81930 for the
ingest feature flag.
  • Loading branch information
k-fish authored Jan 20, 2025
1 parent 2279923 commit f6c85f4
Show file tree
Hide file tree
Showing 31 changed files with 1,058 additions and 41 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
**Internal**:

- Updates performance score calculation on spans and events to also store cdf values as measurements. ([#4438](https://github.com/getsentry/relay/pull/4438))
- Allow log ingestion behind a flag, only for internal use currently. ([#4448](https://github.com/getsentry/relay/pull/4448))

## 24.12.2

Expand Down
21 changes: 19 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ relay-kafka = { path = "relay-kafka" }
relay-log = { path = "relay-log" }
relay-metrics = { path = "relay-metrics" }
relay-monitors = { path = "relay-monitors" }
relay-ourlogs = { path = "relay-ourlogs" }
relay-pattern = { path = "relay-pattern" }
relay-pii = { path = "relay-pii" }
relay-profiling = { path = "relay-profiling" }
Expand Down Expand Up @@ -150,7 +151,7 @@ reqwest = "0.12.9"
rmp-serde = "1.3.0"
sentry = "0.34.0"
sentry-core = "0.34.0"
sentry-kafka-schemas = { version = "0.1.122", default-features = false }
sentry-kafka-schemas = { version = "0.1.129", default-features = false }
sentry-release-parser = { version = "1.3.2", default-features = false }
sentry-types = "0.34.0"
semver = "1.0.23"
Expand Down
2 changes: 1 addition & 1 deletion py/sentry_relay/consts.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@


class DataCategory(IntEnum):
# begin generated
# start generated
DEFAULT = 0
ERROR = 1
TRANSACTION = 2
Expand Down
4 changes: 2 additions & 2 deletions relay-cabi/include/relay.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,14 +143,14 @@ enum RelayDataCategory {
*/
RELAY_DATA_CATEGORY_ATTACHMENT_ITEM = 22,
/**
* LogCount
* LogItem
*
* This is the category for logs for which we store the count log events for users for measuring
* missing breadcrumbs, and count of logs for rate limiting purposes.
*/
RELAY_DATA_CATEGORY_LOG_ITEM = 23,
/**
* LogBytes
* LogByte
*
* This is the category for logs for which we store log event total bytes for users.
*/
Expand Down
3 changes: 3 additions & 0 deletions relay-cogs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ pub enum AppFeature {
Transactions,
/// Errors.
Errors,
/// Logs.
Logs,
/// Spans.
Spans,
/// Sessions.
Expand Down Expand Up @@ -159,6 +161,7 @@ impl AppFeature {
Self::Transactions => "transactions",
Self::Errors => "errors",
Self::Spans => "spans",
Self::Logs => "our_logs",
Self::Sessions => "sessions",
Self::ClientReports => "client_reports",
Self::CheckIns => "check_ins",
Expand Down
8 changes: 8 additions & 0 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -617,6 +617,8 @@ pub struct Limits {
/// The maximum payload size for a profile
pub max_profile_size: ByteSize,
/// The maximum payload size for a span.
pub max_log_size: ByteSize,
/// The maximum payload size for a span.
pub max_span_size: ByteSize,
/// The maximum payload size for a statsd metric.
pub max_statsd_size: ByteSize,
Expand Down Expand Up @@ -683,6 +685,7 @@ impl Default for Limits {
max_api_file_upload_size: ByteSize::mebibytes(40),
max_api_chunk_upload_size: ByteSize::mebibytes(100),
max_profile_size: ByteSize::mebibytes(50),
max_log_size: ByteSize::mebibytes(1),
max_span_size: ByteSize::mebibytes(1),
max_statsd_size: ByteSize::mebibytes(1),
max_metric_buckets_size: ByteSize::mebibytes(1),
Expand Down Expand Up @@ -2213,6 +2216,11 @@ impl Config {
self.values.limits.max_check_in_size.as_bytes()
}

/// Returns the maximum payload size of a log in bytes.
pub fn max_log_size(&self) -> usize {
self.values.limits.max_log_size.as_bytes()
}

/// Returns the maximum payload size of a span in bytes.
pub fn max_span_size(&self) -> usize {
self.values.limits.max_span_size.as_bytes()
Expand Down
6 changes: 5 additions & 1 deletion relay-dynamic-config/src/feature.rs
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,11 @@ pub enum Feature {
/// Serialized as `organizations:ingest-spans-in-eap`
#[serde(rename = "organizations:ingest-spans-in-eap")]
IngestSpansInEap,

/// Enable log ingestion for our log product (this is not internal logging).
///
/// Serialized as `organizations:ourlogs-ingestion`.
#[serde(rename = "organizations:ourlogs-ingestion")]
OurLogsIngestion,
/// This feature has graduated and is hard-coded for external Relays.
#[doc(hidden)]
#[serde(rename = "projects:profiling-ingest-unsampled-profiles")]
Expand Down
2 changes: 2 additions & 0 deletions relay-event-schema/src/processor/attrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ pub enum ValueType {
Message,
Thread,
Breadcrumb,
OurLog,
Span,
ClientSdkInfo,

Expand Down Expand Up @@ -84,6 +85,7 @@ relay_common::derive_fromstr_and_display!(ValueType, UnknownValueTypeError, {
ValueType::Message => "message",
ValueType::Thread => "thread",
ValueType::Breadcrumb => "breadcrumb",
ValueType::OurLog => "ourlog",
ValueType::Span => "span",
ValueType::ClientSdkInfo => "sdk",
ValueType::Minidump => "minidump",
Expand Down
2 changes: 2 additions & 0 deletions relay-event-schema/src/processor/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -108,10 +108,12 @@ pub trait Processor: Sized {
process_method!(process_breadcrumb, crate::protocol::Breadcrumb);
process_method!(process_template_info, crate::protocol::TemplateInfo);
process_method!(process_header_name, crate::protocol::HeaderName);
process_method!(process_ourlog, crate::protocol::OurLog);
process_method!(process_span, crate::protocol::Span);
process_method!(process_trace_context, crate::protocol::TraceContext);
process_method!(process_native_image_path, crate::protocol::NativeImagePath);
process_method!(process_contexts, crate::protocol::Contexts);
process_method!(process_attribute_value, crate::protocol::AttributeValue);

fn process_other(
&mut self,
Expand Down
2 changes: 2 additions & 0 deletions relay-event-schema/src/protocol/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ mod mechanism;
mod metrics;
mod metrics_summary;
mod nel;
mod ourlog;
mod relay_info;
mod replay;
mod request;
Expand Down Expand Up @@ -54,6 +55,7 @@ pub use self::mechanism::*;
pub use self::metrics::*;
pub use self::metrics_summary::*;
pub use self::nel::*;
pub use self::ourlog::*;
pub use self::relay_info::*;
pub use self::replay::*;
pub use self::request::*;
Expand Down
Loading

0 comments on commit f6c85f4

Please sign in to comment.