Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
44 changes: 4 additions & 40 deletions observability/dashboards/product-metrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -1769,24 +1769,6 @@
"type": "prometheus",
"uid": "victoriametrics"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
}
},
"fieldConfig": {
"defaults": {
"color": {
Expand Down Expand Up @@ -1852,24 +1834,6 @@
"type": "prometheus",
"uid": "victoriametrics"
},
"fieldConfig": {
"defaults": {
"color": {
"mode": "thresholds"
},
"mappings": [],
"thresholds": {
"mode": "absolute",
"steps": [
{
"color": "green",
"value": null
}
]
},
"unit": "short"
}
},
"fieldConfig": {
"defaults": {
"color": {
Expand Down Expand Up @@ -2232,7 +2196,7 @@
"pluginVersion": "11.0.0",
"targets": [
{
"expr": "count(count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[24h]) by (session_hash))",
"expr": "count((sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[24h]))) > 0)",

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering condition > 0 is redundant in this context. The count() function already excludes time series with no samples. Since sum by (session_hash) (count_over_time(...)) will only produce results for session_hashes that have at least one sample, the > 0 filter doesn't change the result. Consider simplifying to count(sum by (session_hash) (count_over_time(trackly_session_heartbeat{job="trackly_backend"}[24h]))) for clarity and consistency with the recording rules that use sum by (session_hash) (count_over_time(...)) without the > 0 filter.

Suggested change
"expr": "count((sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[24h]))) > 0)",
"expr": "count(sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[24h])))",

Copilot uses AI. Check for mistakes.
"refId": "A"
}
],
Expand Down Expand Up @@ -2420,7 +2384,7 @@
],
"title": "Funnel: Upload → View → Enrich → Export → Edit → Delete (7d)",
"type": "bargauge"
}
},
{
"datasource": {
"type": "prometheus",
Expand Down Expand Up @@ -2736,7 +2700,7 @@
"pluginVersion": "11.0.0",
"targets": [
{
"expr": "count(count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[7d]) by (session_hash))",
"expr": "count((sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[7d]))) > 0)",

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering condition > 0 is redundant in this context. The count() function already excludes time series with no samples. Since sum by (session_hash) (count_over_time(...)) will only produce results for session_hashes that have at least one sample, the > 0 filter doesn't change the result. Consider simplifying to count(sum by (session_hash) (count_over_time(trackly_session_heartbeat{job="trackly_backend"}[7d]))) for clarity and consistency with the recording rules that use sum by (session_hash) (count_over_time(...)) without the > 0 filter.

Suggested change
"expr": "count((sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[7d]))) > 0)",
"expr": "count(sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[7d])))",

Copilot uses AI. Check for mistakes.
"refId": "A"
}
],
Expand Down Expand Up @@ -2801,7 +2765,7 @@
"pluginVersion": "11.0.0",
"targets": [
{
"expr": "count(count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[30d]) by (session_hash))",
"expr": "count((sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[30d]))) > 0)",

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering condition > 0 is redundant in this context. The count() function already excludes time series with no samples. Since sum by (session_hash) (count_over_time(...)) will only produce results for session_hashes that have at least one sample, the > 0 filter doesn't change the result. Consider simplifying to count(sum by (session_hash) (count_over_time(trackly_session_heartbeat{job="trackly_backend"}[30d]))) for clarity and consistency with the recording rules that use sum by (session_hash) (count_over_time(...)) without the > 0 filter.

Suggested change
"expr": "count((sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[30d]))) > 0)",
"expr": "count(sum by (session_hash) (count_over_time(trackly_session_heartbeat{job=\"trackly_backend\"}[30d])))",

Copilot uses AI. Check for mistakes.
"refId": "A"
}
],
Expand Down
32 changes: 16 additions & 16 deletions observability/recording_rules.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,19 +14,19 @@ groups:
)
- record: sessions_active_1d
expr: |
count(count_over_time(trackly_session_heartbeat[1d]) by (session_hash))
count((sum by (session_hash) (count_over_time(trackly_session_heartbeat[1d]))) > 0)

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering condition > 0 is redundant in this context. The count() function already excludes time series with no samples. Since sum by (session_hash) (count_over_time(...)) will only produce results for session_hashes that have at least one sample, the > 0 filter doesn't change the result. Consider simplifying to count(sum by (session_hash) (count_over_time(trackly_session_heartbeat[1d]))) for clarity and consistency with the other recording rules that use sum by (session_hash) (count_over_time(...)) without the > 0 filter (e.g., lines 27, 29, 58-81).

Copilot uses AI. Check for mistakes.
- record: sessions_active_7d
expr: |
count(count_over_time(trackly_session_heartbeat[7d]) by (session_hash))
count((sum by (session_hash) (count_over_time(trackly_session_heartbeat[7d]))) > 0)

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering condition > 0 is redundant in this context. The count() function already excludes time series with no samples. Since sum by (session_hash) (count_over_time(...)) will only produce results for session_hashes that have at least one sample, the > 0 filter doesn't change the result. Consider simplifying to count(sum by (session_hash) (count_over_time(trackly_session_heartbeat[7d]))) for clarity and consistency with the other recording rules that use sum by (session_hash) (count_over_time(...)) without the > 0 filter (e.g., lines 27, 29, 58-81).

Copilot uses AI. Check for mistakes.
- record: sessions_active_30d
expr: |
count(count_over_time(trackly_session_heartbeat[30d]) by (session_hash))
count((sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d]))) > 0)

Copilot AI Dec 20, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The filtering condition > 0 is redundant in this context. The count() function already excludes time series with no samples. Since sum by (session_hash) (count_over_time(...)) will only produce results for session_hashes that have at least one sample, the > 0 filter doesn't change the result. Consider simplifying to count(sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d]))) for clarity and consistency with the other recording rules that use sum by (session_hash) (count_over_time(...)) without the > 0 filter (e.g., lines 27, 29, 58-81).

Copilot uses AI. Check for mistakes.
- record: sessions_churn_risk
expr: |
count(
count_over_time(trackly_session_heartbeat[30d]) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d]))
unless
count_over_time(trackly_session_heartbeat[14d]) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[14d]))
)
- record: sessions_churn_rate
expr: |
Expand Down Expand Up @@ -55,30 +55,30 @@ groups:
- record: retention_d1
expr: |
count(
count_over_time(trackly_session_heartbeat[1d] offset 1d) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[1d] offset 1d))
and
count_over_time(trackly_session_heartbeat[1d]) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[1d]))
)
/
count(count_over_time(trackly_session_heartbeat[1d] offset 1d) by (session_hash))
count(sum by (session_hash) (count_over_time(trackly_session_heartbeat[1d] offset 1d)))
- record: retention_d7
expr: |
count(
count_over_time(trackly_session_heartbeat[7d] offset 7d) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[7d] offset 7d))
and
count_over_time(trackly_session_heartbeat[7d]) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[7d]))
)
/
count(count_over_time(trackly_session_heartbeat[7d] offset 7d) by (session_hash))
count(sum by (session_hash) (count_over_time(trackly_session_heartbeat[7d] offset 7d)))
- record: retention_d30
expr: |
count(
count_over_time(trackly_session_heartbeat[30d] offset 30d) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d] offset 30d))
and
count_over_time(trackly_session_heartbeat[30d]) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d]))
)
/
count(count_over_time(trackly_session_heartbeat[30d] offset 30d) by (session_hash))
count(sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d] offset 30d)))

# Engagement segments (passive/active/power) derived from engagement_score_7d
- record: engagement_segment_passive
Expand All @@ -95,7 +95,7 @@ groups:
- record: new_sessions_1d_approx
expr: |
count(
count_over_time(trackly_session_heartbeat[1d]) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[1d]))
unless
count_over_time(trackly_session_heartbeat[30d] offset 1d) by (session_hash)
sum by (session_hash) (count_over_time(trackly_session_heartbeat[30d] offset 1d))
)