Per-Tenant Remediation Latency Percentiles From Pipeline Event Logs

Last updated: November 29, 2026

Quick Overview

Given a pandas DataFrame of pipeline events (tenant_id, message_id, event_type in delivered, scored, remediated, ts) where retries can log a stage more than once, compute per tenant the count, p50, p95 and max seconds from delivery to remediation, sorted by worst p95.

Abnormal Security
Data Manipulation (SQL/Python)
Data Scientist
Abnormal Security
November 29, 2026
Data Scientist
Technical Screen
Data Manipulation (SQL/Python)
Medium

0

0

0 solved


Given a pandas DataFrame of pipeline events (tenant_id, message_id, event_type in delivered, scored, remediated, ts) where retries can log a stage more than once, compute per tenant the count, p50, p95 and max seconds from delivery to remediation, sorted by worst p95.

Because Abnormal removes attacks after they land in the inbox, time from delivery to remediation is a headline reliability metric and a natural pandas exercise. The interviewer looks for correct reshaping from long to wide, handling of duplicate and missing stages, and percentile semantics rather than averages.

What the Interviewer Expects
  • Takes the first timestamp per stage to neutralize retries
  • Pivots long events to one row per message
  • Drops messages that were never remediated instead of treating them as zero
  • Guards against negative durations from clock skew
  • Uses percentiles, not means, for a latency SLO
  • Sorts and names output columns clearly
Key Topics to Cover
pandas groupby
pivot and unstack
percentiles
data quality
latency SLOs
How to Approach This
  1. Clarify the schema and expected output format before writing queries.
  2. Use CTEs (WITH clauses) to break complex queries into readable steps.
  3. Consider window functions (ROW_NUMBER, RANK, LAG, LEAD) for ranking and sequential analysis.
  4. Watch for NULLs, duplicates, and edge cases in JOINs and GROUP BY.
  5. For pandas, prefer vectorized operations over row-by-row iteration.
Possible Follow-up Questions
  • How would you report messages that were flagged but never remediated?
  • How would you compute these percentiles over a billion rows without pandas?
  • Which tenants would you exclude when comparing latency week over week?
  • How would you split the latency into stage contributions?
Sharpen Your Skills on Codemia

Practice similar problems with our interactive workspace, get AI feedback, and track your progress.

Practice SQL Problems
Sample Answer
Clarify the Data

Events are long format with one row per stage occurrence. Timestamps are ISO strings in UTC. A message can be scored without being remediated (benign) and can have repeated remediated events from re...

Approach

Take the minimum timestamp per (tenant, message, stage), unstack stages into columns, keep rows that have both endpoints, drop negative durations, compute seconds, then aggregate per tenant with named...


Submit Your Answer
Markdown supported

Related Questions