User experience
Sessions
Browser errors
Page views
P75 page load
Page views and errors
SQL
SELECT a.time, s.series, CASE s.series WHEN 'Page views' THEN a.page_views ELSE a.errors END FROM (SELECT extract(epoch from time_bucket('{{rollup_interval}}', timestamp))::integer AS time, count(*) FILTER (WHERE {{pageview_filter}})::float AS page_views, count(*) FILTER (WHERE {{browser_filter}} AND {{error_filter}})::float AS errors FROM otel_logs_and_spans WHERE {{query_ast_filters}} GROUP BY time_bucket('{{rollup_interval}}', timestamp)) a CROSS JOIN (VALUES ('Page views'), ('Errors')) AS s(series) ORDER BY a.time DESC
No data in this time range
Try a wider time range or adjust the filters.
Top pages
SQL
WITH pages AS (
SELECT COALESCE(NULLIF(regexp_replace(regexp_replace(regexp_replace(regexp_replace(regexp_replace(
COALESCE(NULLIF(CASE WHEN name = 'documentLoad' THEN attributes___url___full END, ''), NULLIF(attributes___url___path, ''), NULLIF(attributes___url___full, ''), replace(name, 'Pageview · ', '')),
'^[A-Za-z][A-Za-z0-9+.-]*://[^/]+', ''), '[?#].*$', ''),
'/[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[^/]*', '/:id', 'g'), '/[0-9][^/]*', '/:id', 'g'), '/[A-Z][A-Z0-9]*[0-9][A-Z0-9]*', '/:id', 'g'), ''), '/') AS page,
duration
FROM otel_logs_and_spans
WHERE {{query_ast_filters}} AND {{pageview_filter}} AND duration IS NOT NULL
)
-- The route as an anchored regex (masked segments match any segment; metacharacters
-- escaped as one-character classes, so the KQL string needs no backslashes).
SELECT page, n::text AS views, p75_ms,
'(name == "documentLoad" or name startswith "Pageview ") and (attributes.url.path matches regex "^' || rx || '$" or attributes.url.full matches regex "^([A-Za-z][A-Za-z0-9+.-]*://[^/?#]+)?' || rx || '([?#].*)?$")' AS kql
FROM (
SELECT page, COUNT(*) AS n,
ROUND((approx_percentile(0.75, percentile_agg(duration)) / 1000000.0)::numeric, 1)::text AS p75_ms,
replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(replace(page, '"', ''), '\', ''),
'.', '[.]'), '+', '[+]'), '*', '[*]'), '(', '[(]'), ')', '[)]'), '$', '[$]'), '|', '[|]'), '{', '[{]'), ':id', '[^/]+') AS rx
FROM pages GROUP BY page ORDER BY COUNT(*) DESC LIMIT 20
) AS top ORDER BY n DESC
Recent sessions
All sessions
SQL
SELECT attributes___session___id AS session,
COALESCE(MAX(attributes___user___full_name), MAX(attributes___user___email), MAX(attributes___user___id), '') AS "user",
COUNT(*) FILTER (WHERE {{pageview_filter}})::text AS page_views,
COUNT(*) FILTER (WHERE {{error_filter}})::text AS errors,
MAX(timestamp)::text AS last_seen
FROM otel_logs_and_spans
WHERE {{query_ast_filters}}
AND {{browser_filter}}
AND attributes___session___id IS NOT NULL
GROUP BY attributes___session___id ORDER BY MAX(timestamp) DESC LIMIT 50