Skip to content

Commit 6ad8786

Browse files
authored
Add metrics for schemas (#218)
1 parent 5e793e6 commit 6ad8786

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/schema/ResourceSchema.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
/* eslint-disable @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-unsafe-argument, @typescript-eslint/no-unsafe-call */
22

3+
import { Measure } from '../telemetry/TelemetryDecorator';
4+
35
/**
46
* Configuration options for path navigation and schema resolution
57
*/
@@ -159,6 +161,7 @@ export class ResourceSchema {
159161
* @param path - JSON pointer to the property (e.g., "/properties/BucketName")
160162
* @returns The property definition or undefined if not found
161163
*/
164+
@Measure({ name: 'path' })
162165
public getByPath<T = any>(path: string): T | undefined {
163166
// Remove leading slash if present
164167
if (path.startsWith('/')) {
@@ -183,6 +186,7 @@ export class ResourceSchema {
183186
return undefined;
184187
}
185188

189+
@Measure({ name: 'resolveRef' })
186190
public resolveRef(refValue: string): PropertyType | undefined {
187191
if (refValue.startsWith('#')) {
188192
refValue = refValue.slice(1);
@@ -331,6 +335,7 @@ export class ResourceSchema {
331335
* @param options.excludeReadOnly - Whether to filter out read-only properties from results
332336
* @returns Array of all possible schema definitions that match the path
333337
*/
338+
@Measure({ name: 'resolveJsonPointer' })
334339
public resolveJsonPointerPath(jsonPointerPath: string, options?: PathNavigationOptions): PropertyType[] {
335340
const resolvedOptions: PathNavigationOptions = {
336341
excludeReadOnly: options?.excludeReadOnly ?? false,

0 commit comments

Comments
 (0)