Skip to content

Commit 1b97f4e

Browse files
viglialzhao-sentry
authored andcommitted
feat(profiling): track the rate of writes of potential functions metrics to store in EAP (#98125)
We'll loosen the constraints on the number and type of functions metrics we'd insert into EAP. Furthermore, each function value will be written to Kafka as an independent message. This metricswill help us get an estimate of the volume we'll be dealing with.
1 parent a16957e commit 1b97f4e

File tree

4 files changed

+49
-7
lines changed

4 files changed

+49
-7
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ dependencies = [
103103
# note: we cannot resolve urllib3[brotli] but brotli is installed
104104
# and will be used
105105
"urllib3>=2.2.2",
106-
"vroomrs>=0.1.17",
106+
"vroomrs>=0.1.18",
107107
"xmlsec>=1.3.14",
108108
"zstandard>=0.18.0",
109109
# [begin] getsentry

src/sentry/options/defaults.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,3 +3480,13 @@
34803480
default=False,
34813481
flags=FLAG_AUTOMATOR_MODIFIABLE,
34823482
)
3483+
3484+
# option used to enable/disable tracking
3485+
# rate of potential functions metrics to
3486+
# be written into EAP
3487+
register(
3488+
"profiling.track_functions_metrics_write_rate.eap.enabled",
3489+
default=False,
3490+
type=Bool,
3491+
flags=FLAG_AUTOMATOR_MODIFIABLE,
3492+
)

src/sentry/profiles/task.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1430,6 +1430,22 @@ def _process_vroomrs_transaction_profile(profile: Profile) -> bool:
14301430
get_topic_definition(Topic.PROCESSED_PROFILES)["real_topic_name"]
14311431
)
14321432
processed_profiles_producer.produce(topic, payload)
1433+
# temporary: collect metrics about rate of functions metrics to be written into EAP
1434+
# should we loosen the constraints on the number and type of functions to be extracted.
1435+
if options.get("profiling.track_functions_metrics_write_rate.eap.enabled"):
1436+
eap_functions = prof.extract_functions_metrics(
1437+
min_depth=1, filter_system_frames=True, filter_non_leaf_functions=False
1438+
)
1439+
if eap_functions is not None and len(eap_functions) > 0:
1440+
tot = 0
1441+
for f in eap_functions:
1442+
tot += len(f.get_self_times_ns())
1443+
metrics.incr(
1444+
"process_profile.eap_functions_metrics.count",
1445+
tot,
1446+
tags={"type": "profile"},
1447+
sample_rate=1.0,
1448+
)
14331449
return True
14341450
except Exception as e:
14351451
sentry_sdk.capture_exception(e)
@@ -1478,6 +1494,22 @@ def _process_vroomrs_chunk_profile(profile: Profile) -> bool:
14781494
get_topic_definition(Topic.PROFILES_CALL_TREE)["real_topic_name"]
14791495
)
14801496
profile_functions_producer.produce(topic, payload)
1497+
# temporary: collect metrics about rate of functions metrics to be written into EAP
1498+
# should we loosen the constraints on the number and type of functions to be extracted.
1499+
if options.get("profiling.track_functions_metrics_write_rate.eap.enabled"):
1500+
eap_functions = chunk.extract_functions_metrics(
1501+
min_depth=1, filter_system_frames=True, filter_non_leaf_functions=False
1502+
)
1503+
if eap_functions is not None and len(eap_functions) > 0:
1504+
tot = 0
1505+
for f in eap_functions:
1506+
tot += len(f.get_self_times_ns())
1507+
metrics.incr(
1508+
"process_profile.eap_functions_metrics.count",
1509+
tot,
1510+
tags={"type": "chunk"},
1511+
sample_rate=1.0,
1512+
)
14811513
return True
14821514
except Exception as e:
14831515
sentry_sdk.capture_exception(e)

uv.lock

Lines changed: 6 additions & 6 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)