Skip to content

Commit c932d24

Browse files
committed
RUM-17613 Build timeseries events from the shared RUM schema
Derive the CPU and memory timeseries schemas from _common-schema.json and replace the hand-written JSON serializers with typed event factories that populate the full common event shape (os, device, connectivity, dd, ddtags). Restrict collection through TimeseriesConfiguration.collectOnly. Ref: RUM-17613
1 parent 212abc3 commit c932d24

70 files changed

Lines changed: 11413 additions & 2750 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

detekt_custom_safe_calls_third_party.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ datadog:
259259
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(com.datadog.android.api.SdkCore?, com.datadog.android.api.SdkCore?)"
260260
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(com.datadog.android.flags.internal.repository.DefaultFlagsRepository.FlagsState?, com.datadog.android.flags.internal.repository.DefaultFlagsRepository.FlagsState?)"
261261
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(com.datadog.trace.bootstrap.instrumentation.api.AgentTracer.TracerAPI?, com.datadog.trace.bootstrap.instrumentation.api.AgentTracer.TracerAPI?)"
262-
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(com.datadog.android.rum.internal.timeseries.DefaultTimeseriesCollector.State?, com.datadog.android.rum.internal.timeseries.DefaultTimeseriesCollector.State?)"
263262
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(com.datadog.android.trace.api.tracer.DatadogTracer?, com.datadog.android.trace.api.tracer.DatadogTracer?)"
264263
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(kotlin.String?, kotlin.String?)"
265264
- "java.util.concurrent.atomic.AtomicReference.compareAndSet(kotlin.collections.Set?, kotlin.collections.Set?)"
@@ -272,14 +271,12 @@ datadog:
272271
- "java.util.concurrent.atomic.AtomicReference.constructor(com.datadog.android.flags.model.FlagsClientState?)"
273272
- "java.util.concurrent.atomic.AtomicReference.constructor(com.datadog.android.flags.model.ProviderContext?)"
274273
- "java.util.concurrent.atomic.AtomicReference.constructor(com.datadog.android.rum.internal.domain.RumContext?)"
275-
- "java.util.concurrent.atomic.AtomicReference.constructor(com.datadog.android.rum.internal.timeseries.DefaultTimeseriesCollector.State?)"
276274
- "java.util.concurrent.atomic.AtomicReference.constructor(kotlin.collections.Map?)"
277275
- "java.util.concurrent.atomic.AtomicReference.constructor(kotlin.String?)"
278276
- "java.util.concurrent.atomic.AtomicReference.constructor(kotlin.collections.Set?)"
279277
- "java.util.concurrent.atomic.AtomicReference.get()"
280278
- "java.util.concurrent.atomic.AtomicReference.getAndSet(kotlin.String?)"
281279
- "java.util.concurrent.atomic.AtomicReference.getAndSet(java.util.concurrent.Future?)"
282-
- "java.util.concurrent.atomic.AtomicReference.getAndSet(com.datadog.android.rum.internal.timeseries.DefaultTimeseriesCollector.State?)"
283280
- "java.util.concurrent.atomic.AtomicReference.set(android.app.Application.ActivityLifecycleCallbacks?)"
284281
- "java.util.concurrent.atomic.AtomicReference.set(com.datadog.android.api.FeatureEventReceiver?)"
285282
- "java.util.concurrent.atomic.AtomicReference.set(com.datadog.android.api.SdkCore?)"
@@ -761,6 +758,8 @@ datadog:
761758
- "kotlin.collections.listOf(com.datadog.android.rum.model.ErrorEvent.Interface)"
762759
- "kotlin.collections.listOf(com.datadog.android.rum.model.LongTaskEvent.Interface)"
763760
- "kotlin.collections.listOf(com.datadog.android.rum.model.ResourceEvent.Interface)"
761+
- "kotlin.collections.listOf(com.datadog.android.rum.model.TimeseriesCpuEvent.Interface)"
762+
- "kotlin.collections.listOf(com.datadog.android.rum.model.TimeseriesMemoryEvent.Interface)"
764763
- "kotlin.collections.listOf(com.datadog.android.rum.model.ViewEvent.Interface)"
765764
- "kotlin.collections.listOf(com.datadog.android.rum.model.VitalAppLaunchEvent.Interface)"
766765
- "kotlin.collections.listOf(com.datadog.android.rum.model.VitalOperationStepEvent.Interface)"

features/dd-sdk-android-rum/api/apiSurface

Lines changed: 1676 additions & 169 deletions
Large diffs are not rendered by default.

features/dd-sdk-android-rum/api/dd-sdk-android-rum.api

Lines changed: 5511 additions & 375 deletions
Large diffs are not rendered by default.

features/dd-sdk-android-rum/src/main/json/rum/_common-schema.json

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
"title": "CommonProperties",
55
"type": "object",
66
"description": "Schema of common properties of RUM events",
7-
"required": ["date", "application", "session", "view", "_dd"],
7+
"required": ["date", "application", "session", "_dd"],
88
"properties": {
99
"date": {
1010
"type": "integer",
@@ -92,7 +92,7 @@
9292
"unity",
9393
"kotlin-multiplatform",
9494
"electron",
95-
"rum-cpp",
95+
"cpp",
9696
"maui"
9797
],
9898
"readOnly": true
@@ -173,6 +173,20 @@
173173
},
174174
"readOnly": true
175175
},
176+
"tab": {
177+
"type": "object",
178+
"description": "Tab properties",
179+
"required": ["id"],
180+
"properties": {
181+
"id": {
182+
"type": "string",
183+
"description": "UUID of the browser tab",
184+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
185+
"readOnly": true
186+
}
187+
},
188+
"readOnly": true
189+
},
176190
"connectivity": {
177191
"type": "object",
178192
"description": "Device connectivity properties",
@@ -455,6 +469,14 @@
455469
"minimum": 0,
456470
"maximum": 100,
457471
"readOnly": true
472+
},
473+
"session_replay_experimental_features": {
474+
"type": "array",
475+
"description": "Session Replay experimental features enabled in the SDK configuration",
476+
"items": {
477+
"type": "string"
478+
},
479+
"readOnly": true
458480
}
459481
}
460482
},
@@ -475,6 +497,19 @@
475497
"type": "object",
476498
"description": "User provided context",
477499
"additionalProperties": true
500+
},
501+
"stream": {
502+
"type": "object",
503+
"description": "Stream properties",
504+
"required": ["id"],
505+
"properties": {
506+
"id": {
507+
"type": "string",
508+
"description": "UUID of the stream",
509+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
510+
"readOnly": true
511+
}
512+
}
478513
}
479514
}
480515
}

features/dd-sdk-android-rum/src/main/json/rum/timeseries-cpu-schema.json

Lines changed: 61 additions & 133 deletions
Original file line numberDiff line numberDiff line change
@@ -4,162 +4,90 @@
44
"title": "RumTimeseriesCpuEvent",
55
"type": "object",
66
"description": "Schema for a CPU timeseries event.",
7-
"required": ["_dd", "application", "date", "session", "source", "timeseries", "type"],
8-
"properties": {
9-
"type": {
10-
"type": "string",
11-
"description": "RUM event type",
12-
"const": "timeseries",
13-
"readOnly": true
7+
"allOf": [
8+
{
9+
"$ref": "_common-schema.json"
1410
},
15-
"_dd": {
16-
"type": "object",
17-
"description": "Internal properties",
18-
"required": ["format_version"],
11+
{
12+
"required": ["type", "timeseries"],
1913
"properties": {
20-
"format_version": {
21-
"type": "integer",
22-
"const": 2,
23-
"description": "Version of the RUM event format",
24-
"readOnly": true
25-
}
26-
},
27-
"readOnly": true
28-
},
29-
"application": {
30-
"type": "object",
31-
"description": "Application properties",
32-
"required": ["id"],
33-
"properties": {
34-
"id": {
35-
"type": "string",
36-
"description": "UUID of the application",
37-
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
38-
"readOnly": true
39-
}
40-
},
41-
"readOnly": true
42-
},
43-
"session": {
44-
"type": "object",
45-
"description": "Session properties",
46-
"required": ["id", "type"],
47-
"properties": {
48-
"id": {
49-
"type": "string",
50-
"description": "UUID of the session",
51-
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
52-
"readOnly": true
53-
},
5414
"type": {
5515
"type": "string",
56-
"description": "Type of the session",
57-
"enum": ["user", "synthetics", "ci_test"],
58-
"readOnly": true
59-
}
60-
},
61-
"readOnly": true
62-
},
63-
"source": {
64-
"type": "string",
65-
"description": "The source of this event",
66-
"enum": [
67-
"android",
68-
"ios",
69-
"browser",
70-
"flutter",
71-
"react-native",
72-
"roku",
73-
"unity",
74-
"kotlin-multiplatform",
75-
"electron",
76-
"rum-cpp"
77-
],
78-
"readOnly": true
79-
},
80-
"date": {
81-
"type": "integer",
82-
"description": "Start of the event in ms from epoch",
83-
"minimum": 0,
84-
"readOnly": true
85-
},
86-
"service": {
87-
"type": "string",
88-
"description": "The service name for this application"
89-
},
90-
"version": {
91-
"type": "string",
92-
"description": "The version for this application"
93-
},
94-
"timeseries": {
95-
"type": "object",
96-
"description": "CPU timeseries properties",
97-
"required": ["id", "name", "schema", "start", "end", "data"],
98-
"properties": {
99-
"id": {
100-
"type": "string",
101-
"description": "UUID of the timeseries batch",
102-
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
16+
"description": "RUM event type",
17+
"const": "timeseries",
10318
"readOnly": true
10419
},
105-
"name": {
106-
"type": "string",
107-
"description": "Name identifying the timeseries metric",
108-
"const": "cpu",
109-
"readOnly": true
110-
},
111-
"schema": {
112-
"type": "string",
113-
"description": "Wire-shape discriminator for the data field",
114-
"const": "object-v2",
115-
"readOnly": true
116-
},
117-
"start": {
118-
"type": "integer",
119-
"description": "Timestamp of the first sample in nanoseconds from epoch",
120-
"readOnly": true
121-
},
122-
"end": {
123-
"type": "integer",
124-
"description": "Timestamp of the last sample in nanoseconds from epoch",
125-
"readOnly": true
126-
},
127-
"data": {
20+
"timeseries": {
12821
"type": "object",
129-
"description": "Flattened CPU data points",
130-
"required": ["timestamps", "values"],
22+
"description": "CPU timeseries properties",
23+
"required": ["id", "name", "schema", "start", "end", "data"],
13124
"properties": {
132-
"timestamps": {
133-
"type": "array",
134-
"description": "Sample timestamps in nanoseconds from epoch",
135-
"items": {
136-
"type": "integer",
137-
"readOnly": true
138-
},
25+
"id": {
26+
"type": "string",
27+
"description": "UUID of the timeseries batch",
28+
"pattern": "^[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{12}$",
13929
"readOnly": true
14030
},
141-
"values": {
31+
"name": {
32+
"type": "string",
33+
"description": "Name identifying the timeseries metric",
34+
"const": "cpu",
35+
"readOnly": true
36+
},
37+
"schema": {
38+
"type": "string",
39+
"description": "Wire-shape discriminator for the data field",
40+
"const": "object-v2",
41+
"readOnly": true
42+
},
43+
"start": {
44+
"type": "integer",
45+
"description": "Timestamp of the first sample in nanoseconds from epoch",
46+
"readOnly": true
47+
},
48+
"end": {
49+
"type": "integer",
50+
"description": "Timestamp of the last sample in nanoseconds from epoch",
51+
"readOnly": true
52+
},
53+
"data": {
14254
"type": "object",
143-
"description": "CPU measurements, aligned index-for-index with timestamps",
144-
"required": ["cpu_usage"],
55+
"description": "Flattened CPU data points",
56+
"required": ["timestamps", "values"],
14557
"properties": {
146-
"cpu_usage": {
58+
"timestamps": {
14759
"type": "array",
148-
"description": "CPU usage as a percentage (0.0 to 100.0)",
60+
"description": "Sample timestamps in nanoseconds from epoch",
14961
"items": {
150-
"type": "number",
62+
"type": "integer",
15163
"readOnly": true
15264
},
15365
"readOnly": true
66+
},
67+
"values": {
68+
"type": "object",
69+
"description": "CPU measurements, aligned index-for-index with timestamps",
70+
"required": ["cpu_usage"],
71+
"properties": {
72+
"cpu_usage": {
73+
"type": "array",
74+
"description": "CPU usage as a percentage (0.0 to 100.0)",
75+
"items": {
76+
"type": "number",
77+
"readOnly": true
78+
},
79+
"readOnly": true
80+
}
81+
},
82+
"readOnly": true
15483
}
15584
},
15685
"readOnly": true
15786
}
15887
},
15988
"readOnly": true
16089
}
161-
},
162-
"readOnly": true
90+
}
16391
}
164-
}
92+
]
16593
}

0 commit comments

Comments
 (0)