[APM] Require _meta in APM Telemetry Schema (#165219)

## Summary

1. Update type to accept `RequireMeta` and make it required for apm
telemetry schmea
2. Add missing descriptions 
3. Cleaning up apm schema a bit

### Related 
- https://github.com/elastic/kibana/pull/157529
This commit is contained in:
Katerina 2023-08-30 16:21:53 +02:00 committed by GitHub
parent e56c0f61ed
commit 7dd2663cba
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 777 additions and 360 deletions

View file

@ -21,7 +21,7 @@ export type {
/**
* Helper to find out whether to keep recursively looking or if we are on an end value
*/
export type RecursiveMakeSchemaFrom<U> = U extends object
export type RecursiveMakeSchemaFrom<U, RequireMeta> = U extends object
? Record<string, unknown> extends U
?
| {
@ -31,19 +31,21 @@ export type RecursiveMakeSchemaFrom<U> = U extends object
description: string; // Intentionally enforcing the descriptions here
} & SchemaMetaOptional<U>;
}
| MakeSchemaFrom<U> // But still allow being explicit in the definition if they want to.
: MakeSchemaFrom<U>
| MakeSchemaFrom<U, RequireMeta> // But still allow being explicit in the definition if they want to.
: MakeSchemaFrom<U, RequireMeta>
: RequireMeta extends true
? { type: PossibleSchemaTypes<U>; _meta: { description: string } }
: { type: PossibleSchemaTypes<U>; _meta?: { description: string } };
/**
* The `schema` property in {@link CollectorOptions} must match the output of
* the `fetch` method. This type helps ensure that is correct
*/
export type MakeSchemaFrom<Base> = {
export type MakeSchemaFrom<Base, RequireMeta = false> = {
// Using Required to enforce all optional keys in the object
[Key in keyof Required<Base>]: Required<Base>[Key] extends Array<infer U>
? { type: 'array'; items: RecursiveMakeSchemaFrom<U> }
: RecursiveMakeSchemaFrom<Required<Base>[Key]>;
? { type: 'array'; items: RecursiveMakeSchemaFrom<U, RequireMeta> }
: RecursiveMakeSchemaFrom<Required<Base>[Key], RequireMeta>;
};
/**

View file

@ -14,76 +14,148 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"services_per_agent": {
"properties": {
"android/java": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the android/java agent within the last day"
}
},
"dotnet": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the dotnet (.Net) agent within the last day"
}
},
"iOS/swift": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the iOS/swift agent within the last day"
}
},
"go": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the go agent within the last day"
}
},
"java": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the Java agent within the last day"
}
},
"js-base": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the js-base agent within the last day"
}
},
"nodejs": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the nodeJS agent within the last day"
}
},
"php": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the PHH agent within the last day"
}
},
"python": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the Python agent within the last day"
}
},
"ruby": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the Ruby agent within the last day"
}
},
"rum-js": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the rum-js agent within the last day"
}
},
"otlp": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the otlp agent within the last day"
}
},
"opentelemetry/cpp": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/cpp agent within the last day"
}
},
"opentelemetry/dotnet": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/dotnet agent within the last day"
}
},
"opentelemetry/erlang": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/erlang agent within the last day"
}
},
"opentelemetry/go": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/go agent within the last day"
}
},
"opentelemetry/java": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/java agent within the last day"
}
},
"opentelemetry/nodejs": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/nodejs agent within the last day"
}
},
"opentelemetry/php": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/php agent within the last day"
}
},
"opentelemetry/python": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/python agent within the last day"
}
},
"opentelemetry/ruby": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/ruby agent within the last day"
}
},
"opentelemetry/rust": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/rust agent within the last day"
}
},
"opentelemetry/swift": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/swift agent within the last day"
}
},
"opentelemetry/webjs": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/webjs agent within the last day"
}
}
}
},
@ -1140,60 +1212,96 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"current_implementation": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"no_observer_name": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"no_rum": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"no_rum_no_observer_name": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"only_rum": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"only_rum_no_observer_name": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
}
@ -1366,10 +1474,10 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"services": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of unique services within the last day"
}
}
}
},
@ -1552,7 +1660,10 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"shards": {
"properties": {
"total": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of shards for metric indices"
}
}
}
},
@ -1563,14 +1674,20 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"docs": {
"properties": {
"count": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of metric documents overall"
}
}
}
},
"store": {
"properties": {
"size_in_bytes": {
"type": "long"
"type": "long",
"_meta": {
"description": "Size of the metric indicess in byte units overall."
}
}
}
}
@ -1587,7 +1704,7 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"total": {
"type": "long",
"_meta": {
"description": "Total number of shards overall"
"description": "Total number of shards for span and trasnaction indices"
}
}
}
@ -1819,7 +1936,10 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"pod": {
"properties": {
"name": {
"type": "keyword"
"type": "keyword",
"_meta": {
"description": "Kuberneted pod name "
}
}
}
}
@ -1828,7 +1948,10 @@ exports[`APM telemetry helpers getApmTelemetry generates a JSON object with the
"container": {
"properties": {
"id": {
"type": "keyword"
"type": "keyword",
"_meta": {
"description": "Container id"
}
}
}
}

File diff suppressed because it is too large Load diff

View file

@ -107,7 +107,7 @@ export interface APMUsage {
max_transaction_groups_per_service: TimeframeMap1d;
max_error_groups_per_service: TimeframeMap1d;
traces: TimeframeMap;
services: TimeframeMap;
services: TimeframeMap1d;
environments: TimeframeMap1d;
span_destination_service_resource: TimeframeMap1d;
};

View file

@ -2728,76 +2728,148 @@
"services_per_agent": {
"properties": {
"android/java": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the android/java agent within the last day"
}
},
"dotnet": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the dotnet (.Net) agent within the last day"
}
},
"iOS/swift": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the iOS/swift agent within the last day"
}
},
"go": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the go agent within the last day"
}
},
"java": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the Java agent within the last day"
}
},
"js-base": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the js-base agent within the last day"
}
},
"nodejs": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the nodeJS agent within the last day"
}
},
"php": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the PHH agent within the last day"
}
},
"python": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the Python agent within the last day"
}
},
"ruby": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the Ruby agent within the last day"
}
},
"rum-js": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the rum-js agent within the last day"
}
},
"otlp": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the otlp agent within the last day"
}
},
"opentelemetry/cpp": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/cpp agent within the last day"
}
},
"opentelemetry/dotnet": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/dotnet agent within the last day"
}
},
"opentelemetry/erlang": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/erlang agent within the last day"
}
},
"opentelemetry/go": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/go agent within the last day"
}
},
"opentelemetry/java": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/java agent within the last day"
}
},
"opentelemetry/nodejs": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/nodejs agent within the last day"
}
},
"opentelemetry/php": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/php agent within the last day"
}
},
"opentelemetry/python": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/python agent within the last day"
}
},
"opentelemetry/ruby": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/ruby agent within the last day"
}
},
"opentelemetry/rust": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/rust agent within the last day"
}
},
"opentelemetry/swift": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/swift agent within the last day"
}
},
"opentelemetry/webjs": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of services utilizing the opentelemetry/webjs agent within the last day"
}
}
}
},
@ -4220,60 +4292,96 @@
"current_implementation": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"no_observer_name": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"no_rum": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"no_rum_no_observer_name": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"only_rum": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
},
"only_rum_no_observer_name": {
"properties": {
"expected_metric_document_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
},
"transaction_count": {
"type": "long"
"type": "long",
"_meta": {
"description": ""
}
}
}
}
@ -4458,10 +4566,10 @@
"services": {
"properties": {
"1d": {
"type": "long"
},
"all": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of unique services within the last day"
}
}
}
},
@ -4644,7 +4752,10 @@
"shards": {
"properties": {
"total": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of shards for metric indices"
}
}
}
},
@ -4655,14 +4766,20 @@
"docs": {
"properties": {
"count": {
"type": "long"
"type": "long",
"_meta": {
"description": "Total number of metric documents overall"
}
}
}
},
"store": {
"properties": {
"size_in_bytes": {
"type": "long"
"type": "long",
"_meta": {
"description": "Size of the metric indicess in byte units overall."
}
}
}
}
@ -4679,7 +4796,7 @@
"total": {
"type": "long",
"_meta": {
"description": "Total number of shards overall"
"description": "Total number of shards for span and trasnaction indices"
}
}
}
@ -4928,7 +5045,10 @@
"pod": {
"properties": {
"name": {
"type": "keyword"
"type": "keyword",
"_meta": {
"description": "Kuberneted pod name "
}
}
}
}
@ -4937,7 +5057,10 @@
"container": {
"properties": {
"id": {
"type": "keyword"
"type": "keyword",
"_meta": {
"description": "Container id"
}
}
}
}