Datadog logo

Datadog Interview Questions

16 practice questions for Datadog technical interviews

Datadog software engineer interviews cover algorithms, data structures, system design, and coding problems drawn from real interview rounds.

Software Engineer Backend Engineer Frontend Engineer Full Stack Engineer Mobile Engineer Data Engineer Data Scientist ML Engineer DevOps Engineer DevOps Engineer Product Manager SRE Security Engineer Engineering Manager Data Analyst UX/UI Designer QA Engineer
coding Easy Verified Question #1

1. Response Time Histogram


Category: Array coding problem
You are given a sorted (ascending) array of response times in milliseconds, a fixed bucket width, and a total number of buckets. Distribute the...
Input: Array
Output: Array
coding Medium Verified Question #2

2. Event Window Aggregator


Category: String coding problem
You are given a list of sensor readings. Each reading has a list of labels, a timestamp, and a numeric value. You are also given a target label and...
Input: Array of strings
Output: Array
coding Easy Verified Question #3

3. Sensor Reading Interpolator


Category: Algorithm coding problem
You are given a sorted list of sensor readings, where each reading is a pair [time, measurement]. The readings are sorted by time in ascending order....
Input: List
Output: Computed result
coding Easy Verified Question #4

4. Label Co-occurrence Finder


Category: String coding problem
You are given a list of label groups and a list of required labels. Each group is a list of strings. A group is considered valid if it contains every...
Input: Array of strings
Output: Array
coding Medium Verified Question #5

5. Denomination Breakdown


Category: Array coding problem
You are given a list of distinct positive integer denominations and a target amount. Find the minimum total number of denominations needed to sum...
Input: Array
Output: Integer
coding Medium Verified Question #6

6. Asset Tree Size


Category: Tree coding problem
You are given a list of asset nodes representing a tree structure and a target path. Each node has a name, an optional size (present only for leaf...
Input: List
Output: Computed result
coding Medium Verified Question #7

7. Storage Cleaner


Category: Trie-based coding problem
You are implementing a recursive storage cleaner. Given a filesystem represented as a dictionary and a starting path, delete all files and...
Input: Array of strings
Output: Computed result
coding Medium Verified Question #8

8. Stream Pattern Matcher


Category: Algorithm coding problem
You are processing a stream of mixed input lines. Each line is either a pattern registration or an event log entry. - A pattern line starts with `P:...
Input: List
Output: Printed output
coding Medium Verified Question #9

9. Packet Buffer


Category: String coding problem
Design a PacketBuffer class that manages a fixed-capacity in-memory buffer for incoming data. Data is flushed to disk in chunks when the buffer...
Input: String
Output: Integer
coding Medium hash map #1

1. Coding — Implement Log Query Logic

Background: Datadog handles vast amounts of log data from various services and applications. Implementing basic query logic is essential for Datadog's observability platform to efficiently filter and analyze logs.
Problem statement: You are tasked with implementing a function that processes a list of log entries and allows querying these logs based on specific filters. Each log entry is represented by a dictionary with attributes such as timestamp, level, and message. Create a function query_logs(logs: List[Dict[str, Any]], level: str) -> List[Dict[str, Any]] that returns all logs of a specific level.
Function/class signature:
  • def query_logs(logs: List[Dict[str, Any]], level: str) -> List[Dict[str, Any]]:

Example 1:
  • Input:

logs = [
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'info', 'message': 'Service started'},
    {'timestamp': '2023-10-01T12:01:00Z', 'level': 'error', 'message': 'Service failed'},
    {'timestamp': '2023-10-01T12:02:00Z', 'level': 'info', 'message': 'Service running'}
]
level = 'info'

  • Output:

[
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'info', 'message': 'Service started'},
    {'timestamp': '2023-10-01T12:02:00Z', 'level': 'info', 'message': 'Service running'}
]

  • Explanation: The function filters the logs and returns only the entries with the info level.

Example 2:
  • Input:

logs = [
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'warning', 'message': 'Low disk space'},
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'error', 'message': 'Unauthorized access'},
]
level = 'error'

  • Output:

[
    {'timestamp': '2023-10-01T12:00:00Z', 'level': 'error', 'message': 'Unauthorized access'}
]

  • Explanation: The function returns the logs with the error level only.

Constraints:
  • 1 <= length of logs <= 10^4

  • level is guaranteed to be one of ['info', 'warning', 'error']
coding Medium hash map #2

2. [Hash Map] — Find the latest metrics for a given service

Background: At Datadog, keeping track of service metrics in real-time is crucial for observability. Handling multiple services and their metrics efficiently allows users to monitor performance and identify issues promptly.
Problem statement: You are tasked with implementing a function that retrieves the latest metric value for a given service based on a list of metric records. Each record contains a timestamp and the service name. If the service has no recorded metrics, return None. The function should return the latest timestamp and its corresponding value for that service.
Function signature:
  • def latest_metric(metrics: List[Tuple[str, str, float]], service_name: str) -> Optional[Tuple[str, float]]:


Example 1:
  • Input: latest_metric([('2023-01-01T12:00:00', 'serviceA', 1.0), ('2023-01-01T12:05:00', 'serviceA', 1.5), ('2023-01-01T12:02:00', 'serviceB', 0.5)], 'serviceA')

  • Output: ('2023-01-01T12:05:00', 1.5)

  • Explanation: The latest entry for serviceA is from 2023-01-01T12:05:00 with a metric value of 1.5.


Example 2:
  • Input: latest_metric([('2023-01-01T12:00:00', 'serviceA', 1.0)], 'serviceB')

  • Output: None

  • Explanation: No metrics were recorded for serviceB.


Constraints:
  • 1 ≤ len(metrics) ≤ 1000

  • Each timestamp is a valid ISO 8601 formatted string.

  • Metric values can be any float.

  • Service names are non-empty strings.


coding Medium hash map #3

3. [Hash Map] — Finding the Frequency of Metrics

Background: In the context of Datadog's monitoring platform, it is crucial to accurately analyze the frequency of various metrics reported over a time frame. This operation aids in optimizing resource allocation and identifying anomalies in system performance.
Problem statement: Given a list of metrics represented as strings and a time frame as an integer, write a function called find_metrics_frequency that returns a dictionary recording the frequency of each metric within that time frame. If a metric appears more than once, it should be counted accordingly.
Function/class signature:
  • def find_metrics_frequency(metrics: List[str], time_frame: int) -> Dict[str, int]:

Example 1:
Input: metrics = ['cpu', 'memory', 'cpu', 'disk', 'memory'], time_frame = 5
Output: {'cpu': 2, 'memory': 2, 'disk': 1}
Explanation: Within the provided list of metrics, 'cpu' and 'memory' each appear twice, while 'disk' appears once.
Example 2:
Input: metrics = ['requests', 'errors', 'errors', 'cpu'], time_frame = 4
Output: {'requests': 1, 'errors': 2, 'cpu': 1}
Constraints:
  • 1 <= len(metrics) <= 10^6

  • Each metric is a string with length at most 100 characters.
coding Medium database #4

4. CODING — Implement a Metrics Monitoring System


Background: Datadog requires a robust metrics monitoring system to optimize the performance and reliability of its observability platform. This involves processing large quantities of time-series data efficiently.
Problem statement: Implement a class MetricsMonitor to handle the storage and retrieval of metrics. The system should support adding metrics, retrieving the average of a metric over a specified time window, and removing metrics older than a given time. The add_metric function should store metrics with a timestamp, while the get_average should compute the average of metrics in the specified time window created from a given timestamp. The remove_old_metrics will eliminate metrics older than a certain threshold.
Function/class signature:
  • def add_metric(name: str, value: float, timestamp: int) -> None:

  • def get_average(name: str, current_time: int, time_window: int) -> float:

  • def remove_old_metrics(current_time: int, threshold: int) -> None:


Example 1:
Input: add_metric("cpu_usage", 30.5, 1609459200)
Output: None
Explanation: A metric for "cpu_usage" with value 30.5 at timestamp 1609459200 was added.
Example 2:
Input: get_average("cpu_usage", 1609459260, 300)
Output: 30.5
Explanation: The average over the last 300 seconds (from timestamp 1609459260) retrieves the previously stored metric value.
Constraints:
  • 0 < timestamp <= 10^9

  • -1000 <= value <= 1000

  • 0 < time_window <= 3600

  • The system can store up to 10^6 metrics.
coding Medium array #5

5. CODING — Calculate Latency Buckets

Background: Datadog handles vast amounts of performance metrics and monitoring data. Analyzing latency metrics is crucial for performance optimization and identifying bottlenecks in systems.
Problem statement: You are given a list of latencies (in milliseconds), a number of buckets, and a bucket_width. Your task is to calculate how frequently each range of latencies occurs. Each bucket covers a width of bucket_width. For example, if the latencies are [10, 20, 30, 20, 15], buckets is 5, and bucket_width is 10, your output should reflect the count of latencies that fall within the respective ranges (0-10, 10-20, etc.).
Function/class signature:
  • def calculate_latency_buckets(latencies: List[int], buckets: int, bucket_width: int) -> List[int]:

Example 1:
  • Input: latencies = [10, 20, 30, 20, 15], buckets = 5, bucket_width = 10

  • Output: [1, 3, 1, 0, 0]

  • Explanation: In the ranges: 0-10 (1), 10-20 (3), 20-30 (1), 30-40 (0)

Example 2:
  • Input: latencies = [1, 12, 25, 3, 30], buckets = 5, bucket_width = 10

  • Output: [2, 1, 1, 1, 0]

Constraints:
  • 1 <= len(latencies) <= 10^4

  • 1 <= latencies[i] <= 10^6

  • 1 <= buckets <= 100

  • 1 <= bucket_width <= 100

coding Medium time #6

6. CODING — Parse and Calculate Real-Time Statistics for Time-Series Events

1. Background: Datadog specializes in monitoring and observability of cloud applications. Accurate parsing and computation of real-time event statistics are crucial for understanding system performance and utilization.
2. Problem statement: You need to maintain a time-series database that stores events occurring at specific timestamps. Write a function that takes a list of events with their timestamps and window size (in seconds), then returns the statistics over the last specified window size for each event. The statistics should include the sum, count, and average of the events within the time window, inclusive of the current event.
3. Function/class signature:
- def calculate_statistics(events: List[Tuple[int, float]], window_size: int) -> List[Tuple[float, int, float]]:
4. Example 1:
- Input: [(1, 10), (2, 20), (3, 30), (4, 40)], window_size=2
- Output: [(10.0, 1, 10.0), (30.0, 2, 15.0), (60.0, 3, 20.0), (40.0, 1, 40.0)]
- Explanation: Event (2, 20) includes (1, 10) and itself; the total is 30 with 2 events averaging to 15.
5. Example 2:
- Input: [(1, 15), (3, 25), (5, 35)], window_size=3
- Output: [(15.0, 1, 15.0), (25.0, 1, 25.0), (35.0, 1, 35.0)]
6. Constraints:
- 1 <= len(events) <= 10^6
- 0 <= events[i][0] <= 10^9
- 0 <= events[i][1] <= 10^9
- 1 <= window_size <= 10000

coding Medium two pointers #7

7. Two Pointers — Finding Unique Metrics within Time Window

Background: Datadog's system monitors various metrics over time and efficiently processes them to identify unique metrics within specified time frames. This is crucial for real-time performance monitoring.
Problem statement: Given a list of metrics represented as strings and an integer timeWindow, return a list of unique metrics that appear in the last timeWindow elements of the list. The result should maintain the order of first appearances in the time window.
Function/class signature:
  • def unique_metrics(metrics: List[str], timeWindow: int) -> List[str]:

Example 1:
  • Input: metrics = ['cpu', 'memory', 'disk', 'cpu', 'network', 'memory'], timeWindow = 4

  • Output: ['disk', 'cpu', 'network', 'memory']

  • Explanation: Within the last 4 metrics, 'cpu', 'network', and 'memory' are unique metrics appearing in their order of first appearance.

Example 2:
  • Input: metrics = ['cpu', 'cpu', 'memory', 'disk'], timeWindow = 2

  • Output: ['memory', 'disk']

  • Explanation: The last two metrics are 'cpu', 'cpu', and the unique metrics after excluding duplicates are 'memory' and 'disk'.

Constraints:
  • 1 ≤ len(metrics) ≤ 1000

  • 1 ≤ timeWindow ≤ len(metrics)

  • Each metric string is unique within the complete list but may repeat within the time window.

Start practicing Datadog questions

Sign up for free to access walkthroughs, AI-generated questions, and more.

Get Started Free