@ms-cloudpack/api-server 0.47.0 → 0.47.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,15 +3,18 @@ import type { ApiParams } from '../types/ApiParams.js';
3
3
  declare const ZodReportMetricInput: z.ZodObject<{
4
4
  metric: z.ZodString;
5
5
  value: z.ZodNumber;
6
+ additionalProperties: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean]>>>;
6
7
  }, "strip", z.ZodTypeAny, {
7
8
  value: number;
8
9
  metric: string;
10
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
9
11
  }, {
10
12
  value: number;
11
13
  metric: string;
14
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
12
15
  }>;
13
16
  export type ReportMetricInput = z.infer<typeof ZodReportMetricInput>;
14
- export declare function reportMetric(params: ApiParams<ReportMetricInput, 'telemetryClient'>): void;
17
+ export declare function reportMetric(params: ApiParams<ReportMetricInput, 'telemetryClient' | 'session'>): void;
15
18
  export declare namespace reportMetric {
16
19
  var procedure: import("@trpc/server").BuildProcedure<"mutation", {
17
20
  _config: import("@trpc/server").RootConfig<{
@@ -25,10 +28,12 @@ export declare namespace reportMetric {
25
28
  _input_in: {
26
29
  value: number;
27
30
  metric: string;
31
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
28
32
  };
29
33
  _input_out: {
30
34
  value: number;
31
35
  metric: string;
36
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
32
37
  };
33
38
  _output_in: typeof import("@trpc/server").unsetMarker;
34
39
  _output_out: typeof import("@trpc/server").unsetMarker;
@@ -1 +1 @@
1
- {"version":3,"file":"reportMetric.d.ts","sourceRoot":"","sources":["../../src/apis/reportMetric.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAA,MAAM,oBAAoB;;;;;;;;;EAGxB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAErE,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,CAAC,GAAG,IAAI,CAM1F;yBANe,YAAY"}
1
+ {"version":3,"file":"reportMetric.d.ts","sourceRoot":"","sources":["../../src/apis/reportMetric.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAEvD,QAAA,MAAM,oBAAoB;;;;;;;;;;;;EAIxB,CAAC;AAEH,MAAM,MAAM,iBAAiB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,oBAAoB,CAAC,CAAC;AAErE,wBAAgB,YAAY,CAAC,MAAM,EAAE,SAAS,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,SAAS,CAAC,GAAG,IAAI,CAatG;yBAbe,YAAY"}
@@ -3,12 +3,20 @@ import { z } from 'zod';
3
3
  const ZodReportMetricInput = z.object({
4
4
  metric: z.string(),
5
5
  value: z.number(),
6
+ additionalProperties: z.optional(z.record(z.union([z.string(), z.number(), z.boolean()]))),
6
7
  });
7
8
  export function reportMetric(params) {
8
9
  const { input, ctx } = params;
9
- const { metric, value } = input;
10
- const { telemetryClient } = ctx;
11
- telemetryClient.performance.record({ name: metric, value });
10
+ const { metric, value, additionalProperties } = input;
11
+ const { telemetryClient, session } = ctx;
12
+ telemetryClient.performance.record({
13
+ name: metric,
14
+ value,
15
+ additionalProperties: {
16
+ ...additionalProperties,
17
+ sequence: session.sequence,
18
+ },
19
+ });
12
20
  }
13
21
  // Attach a trpc procedure to the function.
14
22
  reportMetric.procedure = publicProcedure.input(ZodReportMetricInput).mutation(reportMetric);
@@ -1 +1 @@
1
- {"version":3,"file":"reportMetric.js","sourceRoot":"","sources":["../../src/apis/reportMetric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;CAClB,CAAC,CAAC;AAIH,MAAM,UAAU,YAAY,CAAC,MAAuD;IAClF,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,KAAK,CAAC;IAChC,MAAM,EAAE,eAAe,EAAE,GAAG,GAAG,CAAC;IAEhC,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC,CAAC;AAC9D,CAAC;AAED,2CAA2C;AAC3C,YAAY,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import { publicProcedure } from '../trpc/common.js';\nimport { z } from 'zod';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nconst ZodReportMetricInput = z.object({\n metric: z.string(),\n value: z.number(),\n});\n\nexport type ReportMetricInput = z.infer<typeof ZodReportMetricInput>;\n\nexport function reportMetric(params: ApiParams<ReportMetricInput, 'telemetryClient'>): void {\n const { input, ctx } = params;\n const { metric, value } = input;\n const { telemetryClient } = ctx;\n\n telemetryClient.performance.record({ name: metric, value });\n}\n\n// Attach a trpc procedure to the function.\nreportMetric.procedure = publicProcedure.input(ZodReportMetricInput).mutation(reportMetric);\n"]}
1
+ {"version":3,"file":"reportMetric.js","sourceRoot":"","sources":["../../src/apis/reportMetric.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,MAAM,oBAAoB,GAAG,CAAC,CAAC,MAAM,CAAC;IACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;IAClB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,oBAAoB,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC,CAAC,CAAC;CAC3F,CAAC,CAAC;AAIH,MAAM,UAAU,YAAY,CAAC,MAAmE;IAC9F,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,GAAG,MAAM,CAAC;IAC9B,MAAM,EAAE,MAAM,EAAE,KAAK,EAAE,oBAAoB,EAAE,GAAG,KAAK,CAAC;IACtD,MAAM,EAAE,eAAe,EAAE,OAAO,EAAE,GAAG,GAAG,CAAC;IAEzC,eAAe,CAAC,WAAW,CAAC,MAAM,CAAC;QACjC,IAAI,EAAE,MAAM;QACZ,KAAK;QACL,oBAAoB,EAAE;YACpB,GAAG,oBAAoB;YACvB,QAAQ,EAAE,OAAO,CAAC,QAAQ;SAC3B;KACF,CAAC,CAAC;AACL,CAAC;AAED,2CAA2C;AAC3C,YAAY,CAAC,SAAS,GAAG,eAAe,CAAC,KAAK,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC","sourcesContent":["import { publicProcedure } from '../trpc/common.js';\nimport { z } from 'zod';\nimport type { ApiParams } from '../types/ApiParams.js';\n\nconst ZodReportMetricInput = z.object({\n metric: z.string(),\n value: z.number(),\n additionalProperties: z.optional(z.record(z.union([z.string(), z.number(), z.boolean()]))),\n});\n\nexport type ReportMetricInput = z.infer<typeof ZodReportMetricInput>;\n\nexport function reportMetric(params: ApiParams<ReportMetricInput, 'telemetryClient' | 'session'>): void {\n const { input, ctx } = params;\n const { metric, value, additionalProperties } = input;\n const { telemetryClient, session } = ctx;\n\n telemetryClient.performance.record({\n name: metric,\n value,\n additionalProperties: {\n ...additionalProperties,\n sequence: session.sequence,\n },\n });\n}\n\n// Attach a trpc procedure to the function.\nreportMetric.procedure = publicProcedure.input(ZodReportMetricInput).mutation(reportMetric);\n"]}
@@ -189,10 +189,12 @@ export declare function createAppRouter(): {
189
189
  _input_in: {
190
190
  value: number;
191
191
  metric: string;
192
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
192
193
  };
193
194
  _input_out: {
194
195
  value: number;
195
196
  metric: string;
197
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
196
198
  };
197
199
  _output_in: typeof import("@trpc/server").unsetMarker;
198
200
  _output_out: typeof import("@trpc/server").unsetMarker;
@@ -1 +1 @@
1
- {"version":3,"file":"createAppRouter.d.ts","sourceRoot":"","sources":["../../src/trpc/createAppRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AAGzC,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAQyuG,cAAmB;sCAAqD,cAAmB;sCAAqD,cAAmB;uCAAsD,cAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAHn/G;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC"}
1
+ {"version":3,"file":"createAppRouter.d.ts","sourceRoot":"","sources":["../../src/trpc/createAppRouter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,IAAI,MAAM,kBAAkB,CAAC;AAGzC,wBAAgB,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;qCAQyuG,cAAmB;sCAAqD,cAAmB;sCAAqD,cAAmB;uCAAsD,cAAmB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAHn/G;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,CAAC,OAAO,eAAe,CAAC,CAAC,QAAQ,CAAC,CAAC"}
@@ -37,6 +37,7 @@ export declare function createCloudpackServer(context: Context): Promise<{
37
37
  reportMetric: (options: {
38
38
  value: number;
39
39
  metric: string;
40
+ additionalProperties?: Record<string, string | number | boolean> | undefined;
40
41
  }) => ReturnType<typeof import("../index.js").reportMetric>;
41
42
  restartAllTasks: (options: void) => ReturnType<typeof import("../apis/restartAllTasks.js").restartAllTasks>;
42
43
  restartTask: (options: {
@@ -1 +1 @@
1
- {"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO;;;;;;;;;UA0DuB,UAAU,iDAAY;wFAAtB,UAAU,mDAAY;;;UAAtB,UAAU,sCAAY;qCAAtB,UAAU,2CAAY;;;UAAtB,UAAU,uCAAY;;;UAAtB,UAAU,4CAAY;;;;;;UAAtB,UAAU,6CAAY;yCAAtB,UAAU,+CAAY;;;;UAAtB,UAAU,2CAAY;;;;UAAtB,UAAU,2CAAY;wCAAtB,UAAU,6DAAY;;;;UAAtB,UAAU,qDAAY;;;UAAtB,UAAU,2CAAY;;;UAAtB,UAAU,yCAAY;;;UAAtB,UAAU,mDAAY;;;;;UAAtB,UAAU,sDAAY;GAjBxG;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"createCloudpackServer.d.ts","sourceRoot":"","sources":["../../src/trpc/createCloudpackServer.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AAEnD;;GAEG;AACH,wBAAsB,qBAAqB,CAAC,OAAO,EAAE,OAAO;;;;;;;;;UA0DuB,UAAU,iDAAY;wFAAtB,UAAU,mDAAY;;;UAAtB,UAAU,sCAAY;qCAAtB,UAAU,2CAAY;;;UAAtB,UAAU,uCAAY;;;UAAtB,UAAU,4CAAY;;;;;;UAAtB,UAAU,6CAAY;yCAAtB,UAAU,+CAAY;;;;UAAtB,UAAU,2CAAY;;;;;UAAtB,UAAU,2CAAY;wCAAtB,UAAU,6DAAY;;;;UAAtB,UAAU,qDAAY;;;UAAtB,UAAU,2CAAY;;;UAAtB,UAAU,yCAAY;;;UAAtB,UAAU,mDAAY;;;;;UAAtB,UAAU,sDAAY;GAjBxG;AAED,MAAM,MAAM,eAAe,GAAG,UAAU,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
@@ -4,7 +4,7 @@ import type { PartialContext } from '../types/Context.js';
4
4
  export type BundleTaskInternalOptions = BundleTaskOptions & {
5
5
  bundleRequest: BundleRequest;
6
6
  };
7
- export type BundleTaskInternalContext = PartialContext<'packages' | 'packageHashes' | 'reporter' | 'telemetryClient', 'resolveMap' | 'config'>;
7
+ export type BundleTaskInternalContext = PartialContext<'packages' | 'packageHashes' | 'reporter' | 'telemetryClient', 'resolveMap' | 'config' | 'sequence'>;
8
8
  /**
9
9
  * Create and run a TaskReporter task which calls `bundle()` from `@ms-cloudpack/bundler` and formats the result.
10
10
  */
@@ -1 +1 @@
1
- {"version":3,"file":"bundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,CAAC;AAC7F,MAAM,MAAM,yBAAyB,GAAG,cAAc,CACpD,UAAU,GAAG,eAAe,GAAG,UAAU,GAAG,iBAAiB,EAC7D,YAAY,GAAG,QAAQ,CACxB,CAAC;AAEF;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAuHf"}
1
+ {"version":3,"file":"bundleTask.d.ts","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAC;AAC/D,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAQvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAE1D,MAAM,MAAM,yBAAyB,GAAG,iBAAiB,GAAG;IAAE,aAAa,EAAE,aAAa,CAAA;CAAE,CAAC;AAC7F,MAAM,MAAM,yBAAyB,GAAG,cAAc,CACpD,UAAU,GAAG,eAAe,GAAG,UAAU,GAAG,iBAAiB,EAC7D,YAAY,GAAG,QAAQ,GAAG,UAAU,CACrC,CAAC;AAEF;;GAEG;AACH,wBAAsB,UAAU,CAC9B,OAAO,EAAE,yBAAyB,EAClC,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CA0Hf"}
@@ -18,9 +18,11 @@ export async function bundleTask(options, context) {
18
18
  const { bundleRequest, force, hash, sourceHash } = options;
19
19
  const { packageName, version } = bundleRequest;
20
20
  const { reporter, telemetryClient, packageHashes, packages, session } = context;
21
- const { config } = session;
21
+ const { config, sequence } = session;
22
22
  const { mode } = config;
23
23
  const { retryCount } = options;
24
+ // This will register the disk cache ratio metric aggregator if it's not already registered.
25
+ // This is a no-op if it's already registered.
24
26
  telemetryClient?.performance.registerAggregator(diskCacheRatioMetricEventAggregator);
25
27
  const taskName = `Bundle ${formatPackageName({
26
28
  name: packageName,
@@ -108,7 +110,8 @@ export async function bundleTask(options, context) {
108
110
  // eslint-disable-next-line @typescript-eslint/no-floating-promises
109
111
  writeJson(bundleInfoPath, bundleInfo);
110
112
  }
111
- diskCacheRatioMetricEventAggregator?.record({
113
+ diskCacheRatioMetricEventAggregator.record({
114
+ sequence,
112
115
  isCacheHit: !!bundleRequest.resultFromCache,
113
116
  isExternal: bundleRequest.isExternal,
114
117
  });
@@ -1 +1 @@
1
- {"version":3,"file":"bundleTask.js","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,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AC,UAAU,IAAI,UAAU;oBAClD,IAAI,EAAE,mBAAmB;iBAC1B,CAAC;YACJ,CAAC;YAED,4BAA4B;YAC5B,MAAM,iBAAiB,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;QAChD,CAAC;QAED,4DAA4D;QAC5D,IAAI,mBAAmB,IAAI,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,IAAI,aAAa,CAAC,MAAM,EAAE,WAAW,EAAE,MAAM,EAAE,CAAC;YAC9G,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YAEjE,+EAA+E;YAC/E,iFAAiF;YACjF,2EAA2E;YAC3E,8CAA8C;YAC9C,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAE9E,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC;gBACrC,UAAU;gBACV,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,WAAW;gBAC7C,UAAU;gBACV,UAAU;gBACV,WAAW;aACZ,CAAC,CAAC;YAEH,aAAa,CAAC,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;YAEvC,8DAA8D;YAC9D,mEAAmE;YACnE,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACxC,CAAC;QAED,mCAAmC,EAAE,MAAM,CAAC;YAC1C,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe;YAC3C,UAAU,EAAE,aAAa,CAAC,UAAU;SACrC,CAAC,CAAC;QAEH,OAAO,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { bundle, getEntriesMapFromPackage, getExternalsFromPackage } from '@ms-cloudpack/bundler';\nimport type { BundleOptions } from '@ms-cloudpack/common-types';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { formatPackageName } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport { diskCacheRatioMetricEventAggregator } from './diskCacheRatioMetricEventAggregator.js';\nimport { getBundleInfo } from './getBundleInfo.js';\nimport { getBundleLocation } from './getBundleLocation.js';\nimport { isCachedResultValid } from './isCachedResultValid.js';\nimport { readResultFromCache } from './readResultFromCache.js';\nimport { saveResultToCache } from './saveResultToCache.js';\nimport { formatBundleTaskResult } from './formatBundleTaskResult.js';\nimport type { PartialContext } from '../types/Context.js';\n\nexport type BundleTaskInternalOptions = BundleTaskOptions & { bundleRequest: BundleRequest };\nexport type BundleTaskInternalContext = PartialContext<\n 'packages' | 'packageHashes' | 'reporter' | 'telemetryClient',\n 'resolveMap' | 'config'\n>;\n\n/**\n * Create and run a TaskReporter task which calls `bundle()` from `@ms-cloudpack/bundler` and formats the result.\n */\nexport async function bundleTask(\n options: BundleTaskInternalOptions,\n context: BundleTaskInternalContext,\n): Promise<void> {\n const { bundleRequest, force, hash, sourceHash } = options;\n const { packageName, version } = bundleRequest;\n const { reporter, telemetryClient, packageHashes, packages, session } = context;\n const { config } = session;\n const { mode } = config;\n const { retryCount } = options;\n\n telemetryClient?.performance.registerAggregator(diskCacheRatioMetricEventAggregator);\n\n const taskName = `Bundle ${formatPackageName({\n name: packageName,\n version,\n })}${retryCount ? ` (retry ${retryCount})` : ''}`;\n\n await reporter.runTask(taskName, async () => {\n // If force is set, dispose the existing result.\n if (force && bundleRequest?.result?.dispose) {\n bundleRequest.result.dispose();\n bundleRequest.result = undefined;\n }\n\n const { packagePath, isExternal, isIncremental, disableSourceMaps, shouldGetBundleInfo } = bundleRequest;\n\n const outputPath =\n bundleRequest.outputPath ??\n (await getBundleLocation({ packagePath, shouldRecalculate: force, hash }, context)).path;\n\n // Rehydrate the result if not incremental.\n if (bundleRequest.result === undefined && !force) {\n bundleRequest.result = await readResultFromCache(outputPath, {\n inputPath: packagePath,\n });\n }\n\n const cacheValidationHash = !isExternal\n ? sourceHash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: true, shouldRecalculate: true }))\n : undefined;\n\n // if the cached result is valid, use it.\n if (!force && isCachedResultValid({ bundleRequest, hash: cacheValidationHash })) {\n console.debug(`Using cached result for ${bundleRequest.packageName}@${bundleRequest.version}`);\n bundleRequest.resultFromCache = true;\n } else {\n bundleRequest.resultFromCache = false;\n\n // Only use cached result if it's successful.\n await prepareOutputPath(outputPath);\n\n if (bundleRequest.result?.rebuild) {\n bundleRequest.result = {\n ...(await bundleRequest.result.rebuild()),\n outputPath: bundleRequest.result.outputPath,\n hash: cacheValidationHash,\n };\n } else {\n const settings = (await packages.get(packagePath))?.cloudpack;\n const { bundler, bundlerOptions, inlinedDependencies, dynamicImports, bundlerCapabilities } = settings || {};\n\n const bundleOptions: BundleOptions = {\n bundler: bundleRequest.bundler || bundler,\n minify: mode === 'production',\n bundlerOptions,\n inputPath: packagePath,\n outputPath,\n incremental: isIncremental !== undefined ? isIncremental : false,\n sourcemap: !disableSourceMaps,\n entries: await getEntriesMapFromPackage({ inputPath: packagePath }, { packages, config }),\n inlined: inlinedDependencies,\n external: await getExternalsFromPackage({ inputPath: packagePath }, { packages, config }),\n dynamicImports,\n ignoredBundlerWarnings: settings?.ignoredBundlerWarnings,\n bundlerCapabilities,\n };\n\n const bundleInternalResult = await bundle(bundleOptions, { config });\n bundleRequest.result = {\n ...bundleInternalResult,\n outputPath: bundleOptions.outputPath ?? outputPath,\n hash: cacheValidationHash,\n };\n }\n\n // Write the result to disk.\n await saveResultToCache(bundleRequest.result);\n }\n\n // If we should find required imports and exports per bundle\n if (shouldGetBundleInfo && !bundleRequest.result?.errors?.length && bundleRequest.result?.outputFiles?.length) {\n const bundleInfoPath = path.join(outputPath, 'bundle-info.json');\n\n // Exports map is needed to find the bundle info per entry we intend to bundle.\n // Exports map is used instead of bundleRequest.entries since it is easier to use\n // because it contains the paths other packages use to import the entry and\n // the relative location of the bundled files.\n const exportsMap = await getExportsMap({ packagePath }, { packages, config });\n\n const bundleInfo = await getBundleInfo({\n outputPath,\n outputFiles: bundleRequest.result.outputFiles,\n exportsMap,\n isExternal,\n packagePath,\n });\n\n bundleRequest.result.info = bundleInfo;\n\n // Write to cache for future use. (Ignore the promise result.)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n writeJson(bundleInfoPath, bundleInfo);\n }\n\n diskCacheRatioMetricEventAggregator?.record({\n isCacheHit: !!bundleRequest.resultFromCache,\n isExternal: bundleRequest.isExternal,\n });\n\n return formatBundleTaskResult(bundleRequest);\n });\n}\n"]}
1
+ {"version":3,"file":"bundleTask.js","sourceRoot":"","sources":["../../src/utilities/bundleTask.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,MAAM,uBAAuB,CAAC;AAElG,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAE,iBAAiB,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,gCAAgC,CAAC;AAGnE,OAAO,EAAE,mCAAmC,EAAE,MAAM,0CAA0C,CAAC;AAC/F,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAC/D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,EAAE,sBAAsB,EAAE,MAAM,6B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;YAC9G,MAAM,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE,kBAAkB,CAAC,CAAC;YAEjE,+EAA+E;YAC/E,iFAAiF;YACjF,2EAA2E;YAC3E,8CAA8C;YAC9C,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC,EAAE,WAAW,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,CAAC,CAAC;YAE9E,MAAM,UAAU,GAAG,MAAM,aAAa,CAAC;gBACrC,UAAU;gBACV,WAAW,EAAE,aAAa,CAAC,MAAM,CAAC,WAAW;gBAC7C,UAAU;gBACV,UAAU;gBACV,WAAW;aACZ,CAAC,CAAC;YAEH,aAAa,CAAC,MAAM,CAAC,IAAI,GAAG,UAAU,CAAC;YAEvC,8DAA8D;YAC9D,mEAAmE;YACnE,SAAS,CAAC,cAAc,EAAE,UAAU,CAAC,CAAC;QACxC,CAAC;QAED,mCAAmC,CAAC,MAAM,CAAC;YACzC,QAAQ;YACR,UAAU,EAAE,CAAC,CAAC,aAAa,CAAC,eAAe;YAC3C,UAAU,EAAE,aAAa,CAAC,UAAU;SACrC,CAAC,CAAC;QAEH,OAAO,sBAAsB,CAAC,aAAa,CAAC,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { bundle, getEntriesMapFromPackage, getExternalsFromPackage } from '@ms-cloudpack/bundler';\nimport type { BundleOptions } from '@ms-cloudpack/common-types';\nimport { writeJson } from '@ms-cloudpack/json-utilities';\nimport { getExportsMap } from '@ms-cloudpack/package-utilities';\nimport { formatPackageName } from '@ms-cloudpack/task-reporter';\nimport path from 'path';\nimport { prepareOutputPath } from '../common/prepareOutputPath.js';\nimport type { BundleRequest } from '../types/BundleRequest.js';\nimport type { BundleTaskOptions } from '../types/BundleTaskOptions.js';\nimport { diskCacheRatioMetricEventAggregator } from './diskCacheRatioMetricEventAggregator.js';\nimport { getBundleInfo } from './getBundleInfo.js';\nimport { getBundleLocation } from './getBundleLocation.js';\nimport { isCachedResultValid } from './isCachedResultValid.js';\nimport { readResultFromCache } from './readResultFromCache.js';\nimport { saveResultToCache } from './saveResultToCache.js';\nimport { formatBundleTaskResult } from './formatBundleTaskResult.js';\nimport type { PartialContext } from '../types/Context.js';\n\nexport type BundleTaskInternalOptions = BundleTaskOptions & { bundleRequest: BundleRequest };\nexport type BundleTaskInternalContext = PartialContext<\n 'packages' | 'packageHashes' | 'reporter' | 'telemetryClient',\n 'resolveMap' | 'config' | 'sequence'\n>;\n\n/**\n * Create and run a TaskReporter task which calls `bundle()` from `@ms-cloudpack/bundler` and formats the result.\n */\nexport async function bundleTask(\n options: BundleTaskInternalOptions,\n context: BundleTaskInternalContext,\n): Promise<void> {\n const { bundleRequest, force, hash, sourceHash } = options;\n const { packageName, version } = bundleRequest;\n const { reporter, telemetryClient, packageHashes, packages, session } = context;\n const { config, sequence } = session;\n const { mode } = config;\n const { retryCount } = options;\n\n // This will register the disk cache ratio metric aggregator if it's not already registered.\n // This is a no-op if it's already registered.\n telemetryClient?.performance.registerAggregator(diskCacheRatioMetricEventAggregator);\n\n const taskName = `Bundle ${formatPackageName({\n name: packageName,\n version,\n })}${retryCount ? ` (retry ${retryCount})` : ''}`;\n\n await reporter.runTask(taskName, async () => {\n // If force is set, dispose the existing result.\n if (force && bundleRequest?.result?.dispose) {\n bundleRequest.result.dispose();\n bundleRequest.result = undefined;\n }\n\n const { packagePath, isExternal, isIncremental, disableSourceMaps, shouldGetBundleInfo } = bundleRequest;\n\n const outputPath =\n bundleRequest.outputPath ??\n (await getBundleLocation({ packagePath, shouldRecalculate: force, hash }, context)).path;\n\n // Rehydrate the result if not incremental.\n if (bundleRequest.result === undefined && !force) {\n bundleRequest.result = await readResultFromCache(outputPath, {\n inputPath: packagePath,\n });\n }\n\n const cacheValidationHash = !isExternal\n ? sourceHash || (await packageHashes.get({ packagePath, isSourceHashingEnabled: true, shouldRecalculate: true }))\n : undefined;\n\n // if the cached result is valid, use it.\n if (!force && isCachedResultValid({ bundleRequest, hash: cacheValidationHash })) {\n console.debug(`Using cached result for ${bundleRequest.packageName}@${bundleRequest.version}`);\n bundleRequest.resultFromCache = true;\n } else {\n bundleRequest.resultFromCache = false;\n\n // Only use cached result if it's successful.\n await prepareOutputPath(outputPath);\n\n if (bundleRequest.result?.rebuild) {\n bundleRequest.result = {\n ...(await bundleRequest.result.rebuild()),\n outputPath: bundleRequest.result.outputPath,\n hash: cacheValidationHash,\n };\n } else {\n const settings = (await packages.get(packagePath))?.cloudpack;\n const { bundler, bundlerOptions, inlinedDependencies, dynamicImports, bundlerCapabilities } = settings || {};\n\n const bundleOptions: BundleOptions = {\n bundler: bundleRequest.bundler || bundler,\n minify: mode === 'production',\n bundlerOptions,\n inputPath: packagePath,\n outputPath,\n incremental: isIncremental !== undefined ? isIncremental : false,\n sourcemap: !disableSourceMaps,\n entries: await getEntriesMapFromPackage({ inputPath: packagePath }, { packages, config }),\n inlined: inlinedDependencies,\n external: await getExternalsFromPackage({ inputPath: packagePath }, { packages, config }),\n dynamicImports,\n ignoredBundlerWarnings: settings?.ignoredBundlerWarnings,\n bundlerCapabilities,\n };\n\n const bundleInternalResult = await bundle(bundleOptions, { config });\n bundleRequest.result = {\n ...bundleInternalResult,\n outputPath: bundleOptions.outputPath ?? outputPath,\n hash: cacheValidationHash,\n };\n }\n\n // Write the result to disk.\n await saveResultToCache(bundleRequest.result);\n }\n\n // If we should find required imports and exports per bundle\n if (shouldGetBundleInfo && !bundleRequest.result?.errors?.length && bundleRequest.result?.outputFiles?.length) {\n const bundleInfoPath = path.join(outputPath, 'bundle-info.json');\n\n // Exports map is needed to find the bundle info per entry we intend to bundle.\n // Exports map is used instead of bundleRequest.entries since it is easier to use\n // because it contains the paths other packages use to import the entry and\n // the relative location of the bundled files.\n const exportsMap = await getExportsMap({ packagePath }, { packages, config });\n\n const bundleInfo = await getBundleInfo({\n outputPath,\n outputFiles: bundleRequest.result.outputFiles,\n exportsMap,\n isExternal,\n packagePath,\n });\n\n bundleRequest.result.info = bundleInfo;\n\n // Write to cache for future use. (Ignore the promise result.)\n // eslint-disable-next-line @typescript-eslint/no-floating-promises\n writeJson(bundleInfoPath, bundleInfo);\n }\n\n diskCacheRatioMetricEventAggregator.record({\n sequence,\n isCacheHit: !!bundleRequest.resultFromCache,\n isExternal: bundleRequest.isExternal,\n });\n\n return formatBundleTaskResult(bundleRequest);\n });\n}\n"]}
@@ -1,6 +1,7 @@
1
1
  import type { MetricEventAggregator } from '@ms-cloudpack/telemetry';
2
2
  export interface DiskCacheRatioMetricEvent {
3
3
  isExternal: boolean;
4
+ sequence: number;
4
5
  isCacheHit: boolean;
5
6
  }
6
7
  export declare const diskCacheRatioMetricEventAggregator: MetricEventAggregator<DiskCacheRatioMetricEvent>;
@@ -1 +1 @@
1
- {"version":3,"file":"diskCacheRatioMetricEventAggregator.d.ts","sourceRoot":"","sources":["../../src/utilities/diskCacheRatioMetricEventAggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAElF,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,UAAU,EAAE,OAAO,CAAC;CACrB;AAwED,eAAO,MAAM,mCAAmC,EAAE,qBAAqB,CAAC,yBAAyB,CAGhG,CAAC"}
1
+ {"version":3,"file":"diskCacheRatioMetricEventAggregator.d.ts","sourceRoot":"","sources":["../../src/utilities/diskCacheRatioMetricEventAggregator.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAe,qBAAqB,EAAE,MAAM,yBAAyB,CAAC;AAElF,MAAM,WAAW,yBAAyB;IACxC,UAAU,EAAE,OAAO,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AA+FD,eAAO,MAAM,mCAAmC,EAAE,qBAAqB,CAAC,yBAAyB,CAGhG,CAAC"}
@@ -1,22 +1,27 @@
1
- let externalHitCount = 0;
2
- let externalTotalCount = 0;
3
- let internalHitCount = 0;
4
- let internalTotalCount = 0;
5
- /**
6
- * Increments the hit and total counts for the cache.
7
- * WARNING! This function is in hot path. The performance of this function is critical.
8
- // */
9
- function record({ isCacheHit, isExternal }) {
1
+ const cacheCountsBySequence = new Map();
2
+ /*
3
+ * Increments the hit and total counts for the cache.
4
+ * WARNING! This function is in hot path. The performance of this function is critical.
5
+ */
6
+ function record({ isCacheHit, isExternal, sequence }) {
7
+ let cacheCounts = cacheCountsBySequence.get(sequence);
8
+ if (!cacheCounts) {
9
+ cacheCounts = {
10
+ internalPackages: { hitCount: 0, totalCount: 0 },
11
+ externalPackages: { hitCount: 0, totalCount: 0 },
12
+ };
13
+ cacheCountsBySequence.set(sequence, cacheCounts);
14
+ }
10
15
  if (isExternal) {
11
- externalTotalCount++;
16
+ cacheCounts.externalPackages.totalCount++;
12
17
  if (isCacheHit) {
13
- externalHitCount++;
18
+ cacheCounts.externalPackages.hitCount++;
14
19
  }
15
20
  }
16
21
  else {
17
- internalTotalCount++;
22
+ cacheCounts.internalPackages.totalCount++;
18
23
  if (isCacheHit) {
19
- internalHitCount++;
24
+ cacheCounts.internalPackages.hitCount++;
20
25
  }
21
26
  }
22
27
  }
@@ -26,38 +31,48 @@ function record({ isCacheHit, isExternal }) {
26
31
  */
27
32
  function getAggregatedEvents() {
28
33
  const resultEvents = [];
29
- if (externalTotalCount > 0) {
30
- resultEvents.push({
31
- name: 'DISK_CACHE_RATIO_EXTERNAL',
32
- attributes: {
33
- hitCount: externalHitCount,
34
- missCount: externalTotalCount - externalHitCount,
35
- },
36
- value: externalHitCount / externalTotalCount,
37
- });
38
- }
39
- if (internalTotalCount > 0) {
40
- resultEvents.push({
41
- name: 'DISK_CACHE_RATIO_INTERNAL',
42
- attributes: {
43
- hitCount: internalHitCount,
44
- missCount: internalTotalCount - internalHitCount,
45
- },
46
- value: internalHitCount / internalTotalCount,
47
- });
48
- }
49
- const totalCount = internalTotalCount + externalTotalCount;
50
- const hitCount = externalHitCount + internalHitCount;
51
- const cacheRatio = hitCount / totalCount;
52
- if (totalCount > 0) {
53
- resultEvents.push({
54
- name: 'DISK_CACHE_RATIO',
55
- attributes: {
56
- hitCount: hitCount,
57
- missCount: totalCount - hitCount,
58
- },
59
- value: cacheRatio,
60
- });
34
+ for (const [sequence, cacheCounts] of cacheCountsBySequence) {
35
+ const { internalPackages, externalPackages } = cacheCounts;
36
+ const internalHitCount = internalPackages.hitCount;
37
+ const internalTotalCount = internalPackages.totalCount;
38
+ const externalHitCount = externalPackages.hitCount;
39
+ const externalTotalCount = externalPackages.totalCount;
40
+ if (externalTotalCount > 0) {
41
+ resultEvents.push({
42
+ name: 'DISK_CACHE_RATIO_EXTERNAL',
43
+ attributes: {
44
+ sequence,
45
+ hitCount: externalHitCount,
46
+ missCount: externalTotalCount - externalHitCount,
47
+ },
48
+ value: externalHitCount / externalTotalCount,
49
+ });
50
+ }
51
+ if (internalTotalCount > 0) {
52
+ resultEvents.push({
53
+ name: 'DISK_CACHE_RATIO_INTERNAL',
54
+ attributes: {
55
+ sequence,
56
+ hitCount: internalHitCount,
57
+ missCount: internalTotalCount - internalHitCount,
58
+ },
59
+ value: internalHitCount / internalTotalCount,
60
+ });
61
+ }
62
+ const totalCount = internalTotalCount + externalTotalCount;
63
+ const hitCount = externalHitCount + internalHitCount;
64
+ const cacheRatio = hitCount / totalCount;
65
+ if (totalCount > 0) {
66
+ resultEvents.push({
67
+ name: 'DISK_CACHE_RATIO',
68
+ attributes: {
69
+ sequence,
70
+ hitCount: hitCount,
71
+ missCount: totalCount - hitCount,
72
+ },
73
+ value: cacheRatio,
74
+ });
75
+ }
61
76
  }
62
77
  return resultEvents;
63
78
  }
@@ -1 +1 @@
1
- {"version":3,"file":"diskCacheRatioMetricEventAggregator.js","sourceRoot":"","sources":["../../src/utilities/diskCacheRatioMetricEventAggregator.ts"],"names":[],"mappings":"AAOA,IAAI,gBAAgB,GAAG,CAAC,CAAC;AACzB,IAAI,kBAAkB,GAAG,CAAC,CAAC;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IAAI,CAAC;YAChB,IAAI,EAAE,kBAAkB;YACxB,UAAU,EAAE;gBACV,QAAQ,EAAE,QAAQ;gBAClB,SAAS,EAAE,UAAU,GAAG,QAAQ;aACjC;YACD,KAAK,EAAE,UAAU;SAClB,CAAC,CAAC;IACL,CAAC;IAED,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAqD;IACnG,MAAM;IACN,mBAAmB;CACpB,CAAC","sourcesContent":["import type { MetricEvent, MetricEventAggregator } from '@ms-cloudpack/telemetry';\n\nexport interface DiskCacheRatioMetricEvent {\n isExternal: boolean;\n isCacheHit: boolean;\n}\n\nlet externalHitCount = 0;\nlet externalTotalCount = 0;\nlet internalHitCount = 0;\nlet internalTotalCount = 0;\n\n/**\n * Increments the hit and total counts for the cache.\n * WARNING! This function is in hot path. The performance of this function is critical.\n // */\nfunction record({ isCacheHit, isExternal }: DiskCacheRatioMetricEvent): void {\n if (isExternal) {\n externalTotalCount++;\n if (isCacheHit) {\n externalHitCount++;\n }\n } else {\n internalTotalCount++;\n if (isCacheHit) {\n internalHitCount++;\n }\n }\n}\n\n/**\n * Returns the aggregated events for disk cache ratio. This function will be called when the performance recorder is shutdown.\n * It is not in the hot path.\n */\nfunction getAggregatedEvents(): MetricEvent[] {\n const resultEvents: MetricEvent[] = [];\n\n if (externalTotalCount > 0) {\n resultEvents.push({\n name: 'DISK_CACHE_RATIO_EXTERNAL',\n attributes: {\n hitCount: externalHitCount,\n missCount: externalTotalCount - externalHitCount,\n },\n value: externalHitCount / externalTotalCount,\n });\n }\n\n if (internalTotalCount > 0) {\n resultEvents.push({\n name: 'DISK_CACHE_RATIO_INTERNAL',\n attributes: {\n hitCount: internalHitCount,\n missCount: internalTotalCount - internalHitCount,\n },\n value: internalHitCount / internalTotalCount,\n });\n }\n\n const totalCount = internalTotalCount + externalTotalCount;\n const hitCount = externalHitCount + internalHitCount;\n const cacheRatio = hitCount / totalCount;\n\n if (totalCount > 0) {\n resultEvents.push({\n name: 'DISK_CACHE_RATIO',\n attributes: {\n hitCount: hitCount,\n missCount: totalCount - hitCount,\n },\n value: cacheRatio,\n });\n }\n\n return resultEvents;\n}\n\nexport const diskCacheRatioMetricEventAggregator: MetricEventAggregator<DiskCacheRatioMetricEvent> = {\n record,\n getAggregatedEvents,\n};\n"]}
1
+ {"version":3,"file":"diskCacheRatioMetricEventAggregator.js","sourceRoot":"","sources":["../../src/utilities/diskCacheRatioMetricEventAggregator.ts"],"names":[],"mappings":"AAQA,MAAM,qBAAqB,GAAG,IAAI,GAAG,EAMlC,CAAC;AAEJ;;;GAGG;AACH,SAAS,MAAM,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,QAAQ,EAA6B;IAC7E,IAAI,WAAW,GAAG,qBAAqB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAEtD,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,WAAW,GAAG;YACZ,gBAAgB,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;YAChD,gBAAgB,EAAE,EAAE,QAAQ,EAAE,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE;SACjD,CAAC;QACF,qBAAqB,CAAC,GAAG,CAAC,QAAQ,EAAE,WAAW,CAAC,CAAC;IACnD,CAAC;IAED,IAAI,UAAU,EAAE,CAAC;QACf,WAAW,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAC1C,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAC1C,CAAC;IACH,CAAC;SAAM,CAAC;QACN,WAAW,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC;QAC1C,IAAI,UAAU,EAAE,CAAC;YACf,WAAW,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAAC;QAC1C,CAAC;IACH,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,mBAAmB;IAC1B,MAAM,YAAY,GA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Q;oBACR,QAAQ,EAAE,QAAQ;oBAClB,SAAS,EAAE,UAAU,GAAG,QAAQ;iBACjC;gBACD,KAAK,EAAE,UAAU;aAClB,CAAC,CAAC;QACL,CAAC;IACH,CAAC;IACD,OAAO,YAAY,CAAC;AACtB,CAAC;AAED,MAAM,CAAC,MAAM,mCAAmC,GAAqD;IACnG,MAAM;IACN,mBAAmB;CACpB,CAAC","sourcesContent":["import type { MetricEvent, MetricEventAggregator } from '@ms-cloudpack/telemetry';\n\nexport interface DiskCacheRatioMetricEvent {\n isExternal: boolean;\n sequence: number;\n isCacheHit: boolean;\n}\n\nconst cacheCountsBySequence = new Map<\n number /* sequence */,\n {\n internalPackages: { hitCount: number; totalCount: number };\n externalPackages: { hitCount: number; totalCount: number };\n }\n>();\n\n/*\n * Increments the hit and total counts for the cache.\n * WARNING! This function is in hot path. The performance of this function is critical.\n */\nfunction record({ isCacheHit, isExternal, sequence }: DiskCacheRatioMetricEvent): void {\n let cacheCounts = cacheCountsBySequence.get(sequence);\n\n if (!cacheCounts) {\n cacheCounts = {\n internalPackages: { hitCount: 0, totalCount: 0 },\n externalPackages: { hitCount: 0, totalCount: 0 },\n };\n cacheCountsBySequence.set(sequence, cacheCounts);\n }\n\n if (isExternal) {\n cacheCounts.externalPackages.totalCount++;\n if (isCacheHit) {\n cacheCounts.externalPackages.hitCount++;\n }\n } else {\n cacheCounts.internalPackages.totalCount++;\n if (isCacheHit) {\n cacheCounts.internalPackages.hitCount++;\n }\n }\n}\n\n/**\n * Returns the aggregated events for disk cache ratio. This function will be called when the performance recorder is shutdown.\n * It is not in the hot path.\n */\nfunction getAggregatedEvents(): MetricEvent[] {\n const resultEvents: MetricEvent[] = [];\n\n for (const [sequence, cacheCounts] of cacheCountsBySequence) {\n const { internalPackages, externalPackages } = cacheCounts;\n const internalHitCount = internalPackages.hitCount;\n const internalTotalCount = internalPackages.totalCount;\n const externalHitCount = externalPackages.hitCount;\n const externalTotalCount = externalPackages.totalCount;\n\n if (externalTotalCount > 0) {\n resultEvents.push({\n name: 'DISK_CACHE_RATIO_EXTERNAL',\n attributes: {\n sequence,\n hitCount: externalHitCount,\n missCount: externalTotalCount - externalHitCount,\n },\n value: externalHitCount / externalTotalCount,\n });\n }\n\n if (internalTotalCount > 0) {\n resultEvents.push({\n name: 'DISK_CACHE_RATIO_INTERNAL',\n attributes: {\n sequence,\n hitCount: internalHitCount,\n missCount: internalTotalCount - internalHitCount,\n },\n value: internalHitCount / internalTotalCount,\n });\n }\n\n const totalCount = internalTotalCount + externalTotalCount;\n const hitCount = externalHitCount + internalHitCount;\n const cacheRatio = hitCount / totalCount;\n\n if (totalCount > 0) {\n resultEvents.push({\n name: 'DISK_CACHE_RATIO',\n attributes: {\n sequence,\n hitCount: hitCount,\n missCount: totalCount - hitCount,\n },\n value: cacheRatio,\n });\n }\n }\n return resultEvents;\n}\n\nexport const diskCacheRatioMetricEventAggregator: MetricEventAggregator<DiskCacheRatioMetricEvent> = {\n record,\n getAggregatedEvents,\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ms-cloudpack/api-server",
3
- "version": "0.47.0",
3
+ "version": "0.47.2",
4
4
  "description": "An implementation of the API server that does interacts with a task scheduler.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -27,21 +27,21 @@
27
27
  "@lage-run/logger": "^1.3.0",
28
28
  "@lage-run/scheduler": "^1.2.1",
29
29
  "@lage-run/target-graph": "^0.8.9",
30
- "@ms-cloudpack/bundler": "^0.22.0",
31
- "@ms-cloudpack/common-types": "^0.12.0",
32
- "@ms-cloudpack/config": "^0.23.2",
33
- "@ms-cloudpack/create-express-app": "^1.6.27",
30
+ "@ms-cloudpack/bundler": "^0.22.1",
31
+ "@ms-cloudpack/common-types": "^0.13.0",
32
+ "@ms-cloudpack/config": "^0.23.3",
33
+ "@ms-cloudpack/create-express-app": "^1.6.28",
34
34
  "@ms-cloudpack/data-bus": "^0.4.2",
35
35
  "@ms-cloudpack/file-watcher": "^0.1.2",
36
- "@ms-cloudpack/import-map": "^0.5.21",
36
+ "@ms-cloudpack/import-map": "^0.5.22",
37
37
  "@ms-cloudpack/json-utilities": "^0.1.4",
38
- "@ms-cloudpack/package-hashes": "^0.6.7",
39
- "@ms-cloudpack/package-utilities": "^7.8.3",
38
+ "@ms-cloudpack/package-hashes": "^0.6.8",
39
+ "@ms-cloudpack/package-utilities": "^7.8.4",
40
40
  "@ms-cloudpack/path-string-parsing": "^1.2.3",
41
- "@ms-cloudpack/path-utilities": "^2.7.24",
42
- "@ms-cloudpack/remote-cache": "^0.8.0",
41
+ "@ms-cloudpack/path-utilities": "^2.7.25",
42
+ "@ms-cloudpack/remote-cache": "^0.8.2",
43
43
  "@ms-cloudpack/task-reporter": "^0.14.1",
44
- "@ms-cloudpack/telemetry": "^0.6.0",
44
+ "@ms-cloudpack/telemetry": "^0.6.1",
45
45
  "@trpc/client": "^10.45.0",
46
46
  "@trpc/server": "^10.45.0",
47
47
  "cors": "^2.8.5",