From fc8700fac05dff76e9cb306f886635c4169b45c5 Mon Sep 17 00:00:00 2001 From: guilhermevrs Date: Wed, 4 Sep 2024 11:58:01 +0200 Subject: [PATCH] feat: oops I did it again --- lib/cjs/generated/rumStoredEvents.d.ts | 130 ++++++++++------ lib/esm/generated/rumStoredEvents.d.ts | 130 ++++++++++------ .../rum-stored-events/action-schema.json | 113 +++++++++++++- .../rum-stored-events/view-schema.json | 145 +++++++++++++++++- schemas/rum-stored-events/action-schema.json | 113 +++++++++++++- schemas/rum-stored-events/view-schema.json | 145 +++++++++++++++++- scripts/validate.mjs | 2 + 7 files changed, 662 insertions(+), 116 deletions(-) diff --git a/lib/cjs/generated/rumStoredEvents.d.ts b/lib/cjs/generated/rumStoredEvents.d.ts index c5f0bd2..41faffb 100644 --- a/lib/cjs/generated/rumStoredEvents.d.ts +++ b/lib/cjs/generated/rumStoredEvents.d.ts @@ -8,7 +8,43 @@ export declare type RumStoredEvent = RumStoredActionEvent | RumStoredViewEvent; /** * Schema of all properties of a stored Action event */ -export declare type RumStoredActionEvent = StoredEventCommonProperties & { +export declare type RumStoredActionEvent = { + client_time?: number; + 'datadog.index'?: string; + discovery_timestamp?: number; + event_id?: string; + hashes?: { + session?: HashId; + view?: HashId; + usr?: HashId; + }; + id?: string; + ingest_size_in_bytes?: number; + intake_time?: number; + random_draw?: number; + service?: string; + source?: string; + source_fragment_id?: string; + tag?: { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string | { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string; + }; + }; + tags?: string[]; + tiebreaker?: number; + timeline?: { + token?: string; + }; + timestamp?: string; +} & { /** * Custom properties of the event */ @@ -160,7 +196,43 @@ export declare type RumStoredActionEvent = StoredEventCommonProperties & { /** * Schema of all properties of a stored View event */ -export declare type RumStoredViewEvent = StoredEventCommonProperties & { +export declare type RumStoredViewEvent = { + client_time?: number; + 'datadog.index'?: string; + discovery_timestamp?: number; + event_id?: string; + hashes?: { + session?: HashId1; + view?: HashId1; + usr?: HashId1; + }; + id?: string; + ingest_size_in_bytes?: number; + intake_time?: number; + random_draw?: number; + service?: string; + source?: string; + source_fragment_id?: string; + tag?: { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string | { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string; + }; + }; + tags?: string[]; + tiebreaker?: number; + timeline?: { + token?: string; + }; + timestamp?: string; +} & { /** * Custom properties of the event */ @@ -370,15 +442,15 @@ export declare type RumStoredViewEvent = StoredEventCommonProperties & { /** * Time taken for Flutter 'build' methods. */ - flutter_build_time?: RumStoredPerfMetric; + flutter_build_time?: PerfMetric; /** * Time taken for Flutter to rasterize the view. */ - flutter_raster_time?: RumStoredPerfMetric; + flutter_raster_time?: PerfMetric; /** * The JavaScript refresh rate for React Native */ - js_refresh_rate?: RumStoredPerfMetric; + js_refresh_rate?: PerfMetric; }; /** * Session properties @@ -484,53 +556,13 @@ export declare type RumStoredViewEvent = StoredEventCommonProperties & { }; }; }; -/** - * Schema of common properties of stored RUM events - */ -export interface StoredEventCommonProperties { - client_time?: number; - 'datadog.index'?: string; - discovery_timestamp?: number; - event_id?: string; - hashes?: { - session?: HashId; - view?: HashId; - usr?: HashId; - }; - id?: string; - ingest_size_in_bytes?: number; - intake_time?: number; - random_draw?: number; - service?: string; - source?: string; - source_fragment_id?: string; - tag?: { - /** - * This interface was referenced by `undefined`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string | { - /** - * This interface was referenced by `undefined`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; - }; - }; - tags?: string[]; - tiebreaker?: number; - timeline?: { - token?: string; - }; - timestamp?: string; -} export interface HashId { id: number; } -/** - * Schema of properties for a technical performance metric - */ -export interface RumStoredPerfMetric { +export interface HashId1 { + id: number; +} +export interface PerfMetric { /** * The minimum value seen for this metric during the view's lifetime. */ diff --git a/lib/esm/generated/rumStoredEvents.d.ts b/lib/esm/generated/rumStoredEvents.d.ts index c5f0bd2..41faffb 100644 --- a/lib/esm/generated/rumStoredEvents.d.ts +++ b/lib/esm/generated/rumStoredEvents.d.ts @@ -8,7 +8,43 @@ export declare type RumStoredEvent = RumStoredActionEvent | RumStoredViewEvent; /** * Schema of all properties of a stored Action event */ -export declare type RumStoredActionEvent = StoredEventCommonProperties & { +export declare type RumStoredActionEvent = { + client_time?: number; + 'datadog.index'?: string; + discovery_timestamp?: number; + event_id?: string; + hashes?: { + session?: HashId; + view?: HashId; + usr?: HashId; + }; + id?: string; + ingest_size_in_bytes?: number; + intake_time?: number; + random_draw?: number; + service?: string; + source?: string; + source_fragment_id?: string; + tag?: { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string | { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string; + }; + }; + tags?: string[]; + tiebreaker?: number; + timeline?: { + token?: string; + }; + timestamp?: string; +} & { /** * Custom properties of the event */ @@ -160,7 +196,43 @@ export declare type RumStoredActionEvent = StoredEventCommonProperties & { /** * Schema of all properties of a stored View event */ -export declare type RumStoredViewEvent = StoredEventCommonProperties & { +export declare type RumStoredViewEvent = { + client_time?: number; + 'datadog.index'?: string; + discovery_timestamp?: number; + event_id?: string; + hashes?: { + session?: HashId1; + view?: HashId1; + usr?: HashId1; + }; + id?: string; + ingest_size_in_bytes?: number; + intake_time?: number; + random_draw?: number; + service?: string; + source?: string; + source_fragment_id?: string; + tag?: { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string | { + /** + * This interface was referenced by `undefined`'s JSON-Schema definition + * via the `patternProperty` ".*". + */ + [k: string]: string; + }; + }; + tags?: string[]; + tiebreaker?: number; + timeline?: { + token?: string; + }; + timestamp?: string; +} & { /** * Custom properties of the event */ @@ -370,15 +442,15 @@ export declare type RumStoredViewEvent = StoredEventCommonProperties & { /** * Time taken for Flutter 'build' methods. */ - flutter_build_time?: RumStoredPerfMetric; + flutter_build_time?: PerfMetric; /** * Time taken for Flutter to rasterize the view. */ - flutter_raster_time?: RumStoredPerfMetric; + flutter_raster_time?: PerfMetric; /** * The JavaScript refresh rate for React Native */ - js_refresh_rate?: RumStoredPerfMetric; + js_refresh_rate?: PerfMetric; }; /** * Session properties @@ -484,53 +556,13 @@ export declare type RumStoredViewEvent = StoredEventCommonProperties & { }; }; }; -/** - * Schema of common properties of stored RUM events - */ -export interface StoredEventCommonProperties { - client_time?: number; - 'datadog.index'?: string; - discovery_timestamp?: number; - event_id?: string; - hashes?: { - session?: HashId; - view?: HashId; - usr?: HashId; - }; - id?: string; - ingest_size_in_bytes?: number; - intake_time?: number; - random_draw?: number; - service?: string; - source?: string; - source_fragment_id?: string; - tag?: { - /** - * This interface was referenced by `undefined`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string | { - /** - * This interface was referenced by `undefined`'s JSON-Schema definition - * via the `patternProperty` ".*". - */ - [k: string]: string; - }; - }; - tags?: string[]; - tiebreaker?: number; - timeline?: { - token?: string; - }; - timestamp?: string; -} export interface HashId { id: number; } -/** - * Schema of properties for a technical performance metric - */ -export interface RumStoredPerfMetric { +export interface HashId1 { + id: number; +} +export interface PerfMetric { /** * The minimum value seen for this metric during the view's lifetime. */ diff --git a/lib/schemas/rum-stored-events/action-schema.json b/lib/schemas/rum-stored-events/action-schema.json index ddfe5d9..6b29eb0 100644 --- a/lib/schemas/rum-stored-events/action-schema.json +++ b/lib/schemas/rum-stored-events/action-schema.json @@ -6,10 +6,89 @@ "description": "Schema of all properties of a stored Action event", "allOf": [ { - "$ref": "_common-schema.json" + "type": "object", + "properties": { + "client_time": { + "type": "number" + }, + "datadog.index": { + "type": "string" + }, + "discovery_timestamp": { + "type": "number" + }, + "event_id": { + "type": "string" + }, + "hashes": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/hash_id" + }, + "view": { + "$ref": "#/$defs/hash_id" + }, + "usr": { + "$ref": "#/$defs/hash_id" + } + } + }, + "id": { + "type": "string" + }, + "ingest_size_in_bytes": { + "type": "number" + }, + "intake_time": { + "type": "number" + }, + "random_draw": { + "type": "number" + }, + "service": { + "type": "string" + }, + "source": { + "type": "string" + }, + "source_fragment_id": { + "type": "string" + }, + "tag": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/$defs/tag" + } + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "tiebreaker": { + "type": "number" + }, + "timeline": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + }, + "timestamp": { + "type": "string" + } + } }, { - "required": ["custom"], + "required": [ + "custom" + ], "properties": { "custom": { "type": "object", @@ -249,5 +328,33 @@ } } } - ] + ], + "$defs": { + "hash_id": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "number" + } + } + }, + "tag": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + } + ] + } + } } \ No newline at end of file diff --git a/lib/schemas/rum-stored-events/view-schema.json b/lib/schemas/rum-stored-events/view-schema.json index 80d92f5..b47f329 100644 --- a/lib/schemas/rum-stored-events/view-schema.json +++ b/lib/schemas/rum-stored-events/view-schema.json @@ -6,10 +6,89 @@ "description": "Schema of all properties of a stored View event", "allOf": [ { - "$ref": "_common-schema.json" + "type": "object", + "properties": { + "client_time": { + "type": "number" + }, + "datadog.index": { + "type": "string" + }, + "discovery_timestamp": { + "type": "number" + }, + "event_id": { + "type": "string" + }, + "hashes": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/hash_id" + }, + "view": { + "$ref": "#/$defs/hash_id" + }, + "usr": { + "$ref": "#/$defs/hash_id" + } + } + }, + "id": { + "type": "string" + }, + "ingest_size_in_bytes": { + "type": "number" + }, + "intake_time": { + "type": "number" + }, + "random_draw": { + "type": "number" + }, + "service": { + "type": "string" + }, + "source": { + "type": "string" + }, + "source_fragment_id": { + "type": "string" + }, + "tag": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/$defs/tag" + } + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "tiebreaker": { + "type": "number" + }, + "timeline": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + }, + "timestamp": { + "type": "string" + } + } }, { - "required": ["custom"], + "required": [ + "custom" + ], "properties": { "custom": { "type": "object", @@ -308,7 +387,7 @@ "description": "Time taken for Flutter 'build' methods.", "allOf": [ { - "$ref": "_perf-metric-schema.json" + "$ref": "#/$defs/perf_metric" } ] }, @@ -316,7 +395,7 @@ "description": "Time taken for Flutter to rasterize the view.", "allOf": [ { - "$ref": "_perf-metric-schema.json" + "$ref": "#/$defs/perf_metric" } ] }, @@ -324,7 +403,7 @@ "description": "The JavaScript refresh rate for React Native", "allOf": [ { - "$ref": "_perf-metric-schema.json" + "$ref": "#/$defs/perf_metric" } ] } @@ -483,5 +562,59 @@ } } } - ] + ], + "$defs": { + "hash_id": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "number" + } + } + }, + "tag": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + } + ] + }, + "perf_metric": { + "type": "object", + "required": [ + "min", + "max", + "average" + ], + "properties": { + "min": { + "type": "number", + "description": "The minimum value seen for this metric during the view's lifetime." + }, + "max": { + "type": "number", + "description": "The maximum value seen for this metric during the view's lifetime." + }, + "average": { + "type": "number", + "description": "The average value for this metric during the view's lifetime." + }, + "metric_max": { + "type": "number", + "description": "The maximum possible value we could see for this metric, if such a max is relevant and can vary from session to session." + } + } + } + } } \ No newline at end of file diff --git a/schemas/rum-stored-events/action-schema.json b/schemas/rum-stored-events/action-schema.json index ddfe5d9..6b29eb0 100644 --- a/schemas/rum-stored-events/action-schema.json +++ b/schemas/rum-stored-events/action-schema.json @@ -6,10 +6,89 @@ "description": "Schema of all properties of a stored Action event", "allOf": [ { - "$ref": "_common-schema.json" + "type": "object", + "properties": { + "client_time": { + "type": "number" + }, + "datadog.index": { + "type": "string" + }, + "discovery_timestamp": { + "type": "number" + }, + "event_id": { + "type": "string" + }, + "hashes": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/hash_id" + }, + "view": { + "$ref": "#/$defs/hash_id" + }, + "usr": { + "$ref": "#/$defs/hash_id" + } + } + }, + "id": { + "type": "string" + }, + "ingest_size_in_bytes": { + "type": "number" + }, + "intake_time": { + "type": "number" + }, + "random_draw": { + "type": "number" + }, + "service": { + "type": "string" + }, + "source": { + "type": "string" + }, + "source_fragment_id": { + "type": "string" + }, + "tag": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/$defs/tag" + } + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "tiebreaker": { + "type": "number" + }, + "timeline": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + }, + "timestamp": { + "type": "string" + } + } }, { - "required": ["custom"], + "required": [ + "custom" + ], "properties": { "custom": { "type": "object", @@ -249,5 +328,33 @@ } } } - ] + ], + "$defs": { + "hash_id": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "number" + } + } + }, + "tag": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + } + ] + } + } } \ No newline at end of file diff --git a/schemas/rum-stored-events/view-schema.json b/schemas/rum-stored-events/view-schema.json index 80d92f5..b47f329 100644 --- a/schemas/rum-stored-events/view-schema.json +++ b/schemas/rum-stored-events/view-schema.json @@ -6,10 +6,89 @@ "description": "Schema of all properties of a stored View event", "allOf": [ { - "$ref": "_common-schema.json" + "type": "object", + "properties": { + "client_time": { + "type": "number" + }, + "datadog.index": { + "type": "string" + }, + "discovery_timestamp": { + "type": "number" + }, + "event_id": { + "type": "string" + }, + "hashes": { + "type": "object", + "properties": { + "session": { + "$ref": "#/$defs/hash_id" + }, + "view": { + "$ref": "#/$defs/hash_id" + }, + "usr": { + "$ref": "#/$defs/hash_id" + } + } + }, + "id": { + "type": "string" + }, + "ingest_size_in_bytes": { + "type": "number" + }, + "intake_time": { + "type": "number" + }, + "random_draw": { + "type": "number" + }, + "service": { + "type": "string" + }, + "source": { + "type": "string" + }, + "source_fragment_id": { + "type": "string" + }, + "tag": { + "type": "object", + "patternProperties": { + ".*": { + "$ref": "#/$defs/tag" + } + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "tiebreaker": { + "type": "number" + }, + "timeline": { + "type": "object", + "properties": { + "token": { + "type": "string" + } + } + }, + "timestamp": { + "type": "string" + } + } }, { - "required": ["custom"], + "required": [ + "custom" + ], "properties": { "custom": { "type": "object", @@ -308,7 +387,7 @@ "description": "Time taken for Flutter 'build' methods.", "allOf": [ { - "$ref": "_perf-metric-schema.json" + "$ref": "#/$defs/perf_metric" } ] }, @@ -316,7 +395,7 @@ "description": "Time taken for Flutter to rasterize the view.", "allOf": [ { - "$ref": "_perf-metric-schema.json" + "$ref": "#/$defs/perf_metric" } ] }, @@ -324,7 +403,7 @@ "description": "The JavaScript refresh rate for React Native", "allOf": [ { - "$ref": "_perf-metric-schema.json" + "$ref": "#/$defs/perf_metric" } ] } @@ -483,5 +562,59 @@ } } } - ] + ], + "$defs": { + "hash_id": { + "type": "object", + "required": [ + "id" + ], + "properties": { + "id": { + "type": "number" + } + } + }, + "tag": { + "oneOf": [ + { + "type": "string" + }, + { + "type": "object", + "patternProperties": { + ".*": { + "type": "string" + } + } + } + ] + }, + "perf_metric": { + "type": "object", + "required": [ + "min", + "max", + "average" + ], + "properties": { + "min": { + "type": "number", + "description": "The minimum value seen for this metric during the view's lifetime." + }, + "max": { + "type": "number", + "description": "The maximum value seen for this metric during the view's lifetime." + }, + "average": { + "type": "number", + "description": "The average value for this metric during the view's lifetime." + }, + "metric_max": { + "type": "number", + "description": "The maximum possible value we could see for this metric, if such a max is relevant and can vary from session to session." + } + } + } + } } \ No newline at end of file diff --git a/scripts/validate.mjs b/scripts/validate.mjs index 76cabf8..3adba85 100644 --- a/scripts/validate.mjs +++ b/scripts/validate.mjs @@ -23,6 +23,8 @@ function validateSchemasObjectsPropertiesCase() { [`${SCHEMAS_DIRECTORY}/session-replay/common/focus-record-schema.json`, ['has_focus']], [`${SCHEMAS_DIRECTORY}/rum/resource-schema.json`, ['operationType', 'operationName']], [`${SCHEMAS_DIRECTORY}/rum-stored-events/_common-schema.json`, ['datadog.index']], + [`${SCHEMAS_DIRECTORY}/rum-stored-events/view-schema.json`, ['datadog.index']], + [`${SCHEMAS_DIRECTORY}/rum-stored-events/action-schema.json`, ['datadog.index']], ]) let displayConvention = false