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

feat(metrics): Forward received_at field to Kafka #3561

Merged
merged 24 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Merge
  • Loading branch information
iambriccardo committed May 21, 2024
commit bb4a0a2e6131320235f8215389a25446a82996eb
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
- Send microsecond precision timestamps. ([#3613](https://github.com/getsentry/relay/pull/3613))
- Map outcome reasons for dynamic sampling to reduced set of values. ([#3623](https://github.com/getsentry/relay/pull/3623))
- Extract status for spans. ([#3606](https://github.com/getsentry/relay/pull/3606))
- Forward `received_at` timestamp for buckets sent to Kafka. ([#3561](https://github.com/getsentry/relay/pull/3561))

## 24.5.0

Expand Down Expand Up @@ -53,7 +54,6 @@
- Extract additional user fields for spans. ([#3599](https://github.com/getsentry/relay/pull/3599))
- Disable `db.redis` span metrics extraction. ([#3600](https://github.com/getsentry/relay/pull/3600))
- Extract status for spans. ([#3606](https://github.com/getsentry/relay/pull/3606))
- Forward `received_at` timestamp for buckets sent to Kafka. ([#3561](https://github.com/getsentry/relay/pull/3561))

## 24.4.2

Expand Down
67 changes: 67 additions & 0 deletions tests/integration/test_metrics.py
Original file line number Diff line number Diff line change
Expand Up @@ -1937,3 +1937,70 @@ def test_metrics_received_at(
"retention_days": 90,
"received_at": time_after(timestamp),
}


def test_histogram_outliers(mini_sentry, relay):
with open(Path(__file__).parent / "fixtures/histogram-outliers.yml") as f:
mini_sentry.global_config["metricExtraction"] = yaml.full_load(f)
project_config = mini_sentry.add_full_project_config(project_id=42)["config"]
project_config["transactionMetrics"] = {
"version": 1,
}
project_config["metricExtraction"] = {
"version": 3,
"globalGroups": {"histogram_outliers": {"isEnabled": True}},
}
project_config["sampling"] = { # Drop everything, to trigger metrics extractino
"version": 2,
"rules": [
{
"id": 1,
"samplingValue": {"type": "sampleRate", "value": 0.0},
"type": "transaction",
"condition": {"op": "and", "inner": []},
}
],
}

timestamp = datetime.now(tz=timezone.utc)

event = {
"type": "transaction",
"transaction": "foo",
"transaction_info": {"source": "url"}, # 'transaction' tag not extracted
"platform": "javascript",
"contexts": {
"trace": {
"op": "pageload",
"trace_id": 32 * "b",
"span_id": 16 * "c",
"type": "trace",
}
},
"user": {"id": 123},
"measurements": {
"fcp": {"value": 999999999.0},
"lcp": {"value": 0.0},
},
}
event["timestamp"] = timestamp.isoformat()
event["start_timestamp"] = (timestamp - timedelta(seconds=2)).isoformat()

relay = relay(mini_sentry, TEST_CONFIG)
relay.send_event(42, event)

tags = {}
for _ in range(2):
envelope = mini_sentry.captured_events.get()
for item in envelope:
if item.type == "metric_buckets":
buckets = item.payload.json
for bucket in buckets:
if outlier := bucket.get("tags", {}).get("histogram_outlier"):
tags[bucket["name"]] = outlier

assert tags == {
"d:transactions/measurements.fcp@millisecond": "outlier",
"d:transactions/duration@millisecond": "inlier",
"d:transactions/measurements.lcp@millisecond": "inlier",
}
Loading
You are viewing a condensed version of this merge commit. You can view the full changes here.