Skip to content

Commit

Permalink
add measurement markers in sample acceptance transaction data
Browse files Browse the repository at this point in the history
  • Loading branch information
dashed committed Oct 26, 2020
1 parent 76d0678 commit 7bfb7ab
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/sentry/utils/samples.py
Expand Up @@ -169,7 +169,7 @@ def load_data(

if data.get("type") == "transaction":
if start_timestamp is None:
start_timestamp = timestamp - timedelta(seconds=2)
start_timestamp = timestamp - timedelta(seconds=3)
else:
start_timestamp = start_timestamp.replace(tzinfo=pytz.utc)
data["start_timestamp"] = to_timestamp(start_timestamp)
Expand Down Expand Up @@ -200,6 +200,17 @@ def load_data(
span.setdefault("start_timestamp", span_start)
span.setdefault("timestamp", span_start + duration)

measurements = data.get("measurements")

if measurements:
measurement_markers = {}
for key, entry in measurements.items():
if key in ["fp", "fcp", "lcp", "fid"]:
measurement_markers["mark.{}".format(key)] = {
"value": data["start_timestamp"] + entry["value"] / 1000
}
measurements.update(measurement_markers)

data["platform"] = platform
# XXX: Message is a legacy alias for logentry. Do not overwrite if set.
if "message" not in data:
Expand Down

0 comments on commit 7bfb7ab

Please sign in to comment.