@frengki0707/google-cloud-clone 1.33.0
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.
- package/LICENSE +203 -0
- package/README.md +83 -0
- package/lib/auth.d.mts +33 -0
- package/lib/auth.d.ts +33 -0
- package/lib/auth.js +70 -0
- package/lib/auth.js.map +1 -0
- package/lib/auth.mjs +45 -0
- package/lib/auth.mjs.map +1 -0
- package/lib/gcpLogger.d.mts +25 -0
- package/lib/gcpLogger.d.ts +25 -0
- package/lib/gcpLogger.js +118 -0
- package/lib/gcpLogger.js.map +1 -0
- package/lib/gcpLogger.mjs +82 -0
- package/lib/gcpLogger.mjs.map +1 -0
- package/lib/gcpOpenTelemetry.d.mts +59 -0
- package/lib/gcpOpenTelemetry.d.ts +59 -0
- package/lib/gcpOpenTelemetry.js +374 -0
- package/lib/gcpOpenTelemetry.js.map +1 -0
- package/lib/gcpOpenTelemetry.mjs +364 -0
- package/lib/gcpOpenTelemetry.mjs.map +1 -0
- package/lib/index.d.mts +36 -0
- package/lib/index.d.ts +36 -0
- package/lib/index.js +56 -0
- package/lib/index.js.map +1 -0
- package/lib/index.mjs +29 -0
- package/lib/index.mjs.map +1 -0
- package/lib/metrics.d.mts +65 -0
- package/lib/metrics.d.ts +65 -0
- package/lib/metrics.js +91 -0
- package/lib/metrics.js.map +1 -0
- package/lib/metrics.mjs +65 -0
- package/lib/metrics.mjs.map +1 -0
- package/lib/model-armor.d.mts +59 -0
- package/lib/model-armor.d.ts +59 -0
- package/lib/model-armor.js +205 -0
- package/lib/model-armor.js.map +1 -0
- package/lib/model-armor.mjs +181 -0
- package/lib/model-armor.mjs.map +1 -0
- package/lib/telemetry/action.d.mts +27 -0
- package/lib/telemetry/action.d.ts +27 -0
- package/lib/telemetry/action.js +92 -0
- package/lib/telemetry/action.js.map +1 -0
- package/lib/telemetry/action.mjs +73 -0
- package/lib/telemetry/action.mjs.map +1 -0
- package/lib/telemetry/defaults.d.mts +30 -0
- package/lib/telemetry/defaults.d.ts +30 -0
- package/lib/telemetry/defaults.js +70 -0
- package/lib/telemetry/defaults.js.map +1 -0
- package/lib/telemetry/defaults.mjs +46 -0
- package/lib/telemetry/defaults.mjs.map +1 -0
- package/lib/telemetry/engagement.d.mts +35 -0
- package/lib/telemetry/engagement.d.ts +35 -0
- package/lib/telemetry/engagement.js +106 -0
- package/lib/telemetry/engagement.js.map +1 -0
- package/lib/telemetry/engagement.mjs +85 -0
- package/lib/telemetry/engagement.mjs.map +1 -0
- package/lib/telemetry/feature.d.mts +35 -0
- package/lib/telemetry/feature.d.ts +35 -0
- package/lib/telemetry/feature.js +142 -0
- package/lib/telemetry/feature.js.map +1 -0
- package/lib/telemetry/feature.mjs +127 -0
- package/lib/telemetry/feature.mjs.map +1 -0
- package/lib/telemetry/generate.d.mts +53 -0
- package/lib/telemetry/generate.d.ts +53 -0
- package/lib/telemetry/generate.js +326 -0
- package/lib/telemetry/generate.js.map +1 -0
- package/lib/telemetry/generate.mjs +314 -0
- package/lib/telemetry/generate.mjs.map +1 -0
- package/lib/telemetry/path.d.mts +32 -0
- package/lib/telemetry/path.d.ts +32 -0
- package/lib/telemetry/path.js +91 -0
- package/lib/telemetry/path.js.map +1 -0
- package/lib/telemetry/path.mjs +78 -0
- package/lib/telemetry/path.mjs.map +1 -0
- package/lib/types.d.mts +121 -0
- package/lib/types.d.ts +121 -0
- package/lib/types.js +17 -0
- package/lib/types.js.map +1 -0
- package/lib/types.mjs +1 -0
- package/lib/types.mjs.map +1 -0
- package/lib/utils.d.mts +57 -0
- package/lib/utils.d.ts +57 -0
- package/lib/utils.js +143 -0
- package/lib/utils.js.map +1 -0
- package/lib/utils.mjs +104 -0
- package/lib/utils.mjs.map +1 -0
- package/package.json +89 -0
- package/src/auth.ts +89 -0
- package/src/gcpLogger.ts +124 -0
- package/src/gcpOpenTelemetry.ts +485 -0
- package/src/index.ts +59 -0
- package/src/metrics.ts +122 -0
- package/src/model-armor.ts +317 -0
- package/src/telemetry/action.ts +106 -0
- package/src/telemetry/defaults.ts +72 -0
- package/src/telemetry/engagement.ts +120 -0
- package/src/telemetry/feature.ts +170 -0
- package/src/telemetry/generate.ts +454 -0
- package/src/telemetry/path.ts +111 -0
- package/src/types.ts +133 -0
- package/src/utils.ts +175 -0
- package/tests/logs_no_input_output_test.ts +267 -0
- package/tests/logs_session_test.ts +219 -0
- package/tests/logs_test.ts +633 -0
- package/tests/metrics_test.ts +792 -0
- package/tests/model_armor_test.ts +336 -0
- package/tests/traces_test.ts +380 -0
- package/typedoc.json +3 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { Telemetry } from '../metrics.mjs';
|
|
3
|
+
import '@opentelemetry/api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright 2024 Google LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare class EngagementTelemetry implements Telemetry {
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
24
|
+
*/
|
|
25
|
+
private _N;
|
|
26
|
+
private feedbackCounter;
|
|
27
|
+
private acceptanceCounter;
|
|
28
|
+
tick(span: ReadableSpan, logInputAndOutput: boolean, projectId?: string): void;
|
|
29
|
+
private writeUserFeedback;
|
|
30
|
+
private writeUserAcceptance;
|
|
31
|
+
private extractTraceName;
|
|
32
|
+
}
|
|
33
|
+
declare const engagementTelemetry: EngagementTelemetry;
|
|
34
|
+
|
|
35
|
+
export { engagementTelemetry };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { Telemetry } from '../metrics.js';
|
|
3
|
+
import '@opentelemetry/api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright 2024 Google LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare class EngagementTelemetry implements Telemetry {
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
24
|
+
*/
|
|
25
|
+
private _N;
|
|
26
|
+
private feedbackCounter;
|
|
27
|
+
private acceptanceCounter;
|
|
28
|
+
tick(span: ReadableSpan, logInputAndOutput: boolean, projectId?: string): void;
|
|
29
|
+
private writeUserFeedback;
|
|
30
|
+
private writeUserAcceptance;
|
|
31
|
+
private extractTraceName;
|
|
32
|
+
}
|
|
33
|
+
declare const engagementTelemetry: EngagementTelemetry;
|
|
34
|
+
|
|
35
|
+
export { engagementTelemetry };
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var engagement_exports = {};
|
|
20
|
+
__export(engagement_exports, {
|
|
21
|
+
engagementTelemetry: () => engagementTelemetry
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(engagement_exports);
|
|
24
|
+
var import_api = require("@opentelemetry/api");
|
|
25
|
+
var import_genkit = require("genkit");
|
|
26
|
+
var import_logging = require("genkit/logging");
|
|
27
|
+
var import_metrics = require("../metrics.js");
|
|
28
|
+
var import_utils = require("../utils.js");
|
|
29
|
+
class EngagementTelemetry {
|
|
30
|
+
/**
|
|
31
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
32
|
+
*/
|
|
33
|
+
_N = import_metrics.internalMetricNamespaceWrap.bind(null, "engagement");
|
|
34
|
+
feedbackCounter = new import_metrics.MetricCounter(this._N("feedback"), {
|
|
35
|
+
description: "Counts calls to genkit flows.",
|
|
36
|
+
valueType: import_api.ValueType.INT
|
|
37
|
+
});
|
|
38
|
+
acceptanceCounter = new import_metrics.MetricCounter(this._N("acceptance"), {
|
|
39
|
+
description: "Tracks unique flow paths per flow.",
|
|
40
|
+
valueType: import_api.ValueType.INT
|
|
41
|
+
});
|
|
42
|
+
tick(span, logInputAndOutput, projectId) {
|
|
43
|
+
const subtype = span.attributes["genkit:metadata:subtype"];
|
|
44
|
+
if (subtype === "userFeedback") {
|
|
45
|
+
this.writeUserFeedback(span, projectId);
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
if (subtype === "userAcceptance") {
|
|
49
|
+
this.writeUserAcceptance(span, projectId);
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
import_logging.logger.warn(`Unknown user engagement subtype: ${subtype}`);
|
|
53
|
+
}
|
|
54
|
+
writeUserFeedback(span, projectId) {
|
|
55
|
+
const attributes = span.attributes;
|
|
56
|
+
const name = this.extractTraceName(attributes);
|
|
57
|
+
const dimensions = {
|
|
58
|
+
name,
|
|
59
|
+
value: attributes["genkit:metadata:feedbackValue"],
|
|
60
|
+
hasText: !!attributes["genkit:metadata:textFeedback"],
|
|
61
|
+
source: "ts",
|
|
62
|
+
sourceVersion: import_genkit.GENKIT_VERSION
|
|
63
|
+
};
|
|
64
|
+
this.feedbackCounter.add(1, dimensions);
|
|
65
|
+
const metadata = {
|
|
66
|
+
...(0, import_utils.createCommonLogAttributes)(span, projectId),
|
|
67
|
+
feedbackValue: attributes["genkit:metadata:feedbackValue"]
|
|
68
|
+
};
|
|
69
|
+
if (attributes["genkit:metadata:textFeedback"]) {
|
|
70
|
+
metadata["textFeedback"] = (0, import_utils.truncate)(
|
|
71
|
+
attributes["genkit:metadata:textFeedback"]
|
|
72
|
+
);
|
|
73
|
+
}
|
|
74
|
+
import_logging.logger.logStructured(`UserFeedback[${name}]`, metadata);
|
|
75
|
+
}
|
|
76
|
+
writeUserAcceptance(span, projectId) {
|
|
77
|
+
const attributes = span.attributes;
|
|
78
|
+
const name = this.extractTraceName(attributes);
|
|
79
|
+
const dimensions = {
|
|
80
|
+
name,
|
|
81
|
+
value: attributes["genkit:metadata:acceptanceValue"],
|
|
82
|
+
source: "ts",
|
|
83
|
+
sourceVersion: import_genkit.GENKIT_VERSION
|
|
84
|
+
};
|
|
85
|
+
this.acceptanceCounter.add(1, dimensions);
|
|
86
|
+
const metadata = {
|
|
87
|
+
...(0, import_utils.createCommonLogAttributes)(span, projectId),
|
|
88
|
+
acceptanceValue: attributes["genkit:metadata:acceptanceValue"]
|
|
89
|
+
};
|
|
90
|
+
import_logging.logger.logStructured(`UserAcceptance[${name}]`, metadata);
|
|
91
|
+
}
|
|
92
|
+
extractTraceName(attributes) {
|
|
93
|
+
const path = attributes["genkit:path"];
|
|
94
|
+
if (!path || path === "<unknown>") {
|
|
95
|
+
return "<unknown>";
|
|
96
|
+
}
|
|
97
|
+
const name = path.match("/{(.+)}+");
|
|
98
|
+
return name ? name[1] : "<unknown>";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
const engagementTelemetry = new EngagementTelemetry();
|
|
102
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
103
|
+
0 && (module.exports = {
|
|
104
|
+
engagementTelemetry
|
|
105
|
+
});
|
|
106
|
+
//# sourceMappingURL=engagement.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/engagement.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ValueType, type Attributes } from '@opentelemetry/api';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { GENKIT_VERSION } from 'genkit';\nimport { logger } from 'genkit/logging';\nimport {\n MetricCounter,\n internalMetricNamespaceWrap,\n type Telemetry,\n} from '../metrics.js';\nimport { createCommonLogAttributes, truncate } from '../utils.js';\n\nclass EngagementTelemetry implements Telemetry {\n /**\n * Wraps the declared metrics in a Genkit-specific, internal namespace.\n */\n private _N = internalMetricNamespaceWrap.bind(null, 'engagement');\n\n private feedbackCounter = new MetricCounter(this._N('feedback'), {\n description: 'Counts calls to genkit flows.',\n valueType: ValueType.INT,\n });\n\n private acceptanceCounter = new MetricCounter(this._N('acceptance'), {\n description: 'Tracks unique flow paths per flow.',\n valueType: ValueType.INT,\n });\n\n tick(\n span: ReadableSpan,\n logInputAndOutput: boolean,\n projectId?: string\n ): void {\n const subtype = span.attributes['genkit:metadata:subtype'] as string;\n\n if (subtype === 'userFeedback') {\n this.writeUserFeedback(span, projectId);\n return;\n }\n\n if (subtype === 'userAcceptance') {\n this.writeUserAcceptance(span, projectId);\n return;\n }\n\n logger.warn(`Unknown user engagement subtype: ${subtype}`);\n }\n\n private writeUserFeedback(span: ReadableSpan, projectId?: string) {\n const attributes = span.attributes;\n const name = this.extractTraceName(attributes);\n\n const dimensions = {\n name,\n value: attributes['genkit:metadata:feedbackValue'],\n hasText: !!attributes['genkit:metadata:textFeedback'],\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n };\n this.feedbackCounter.add(1, dimensions);\n\n const metadata = {\n ...createCommonLogAttributes(span, projectId),\n feedbackValue: attributes['genkit:metadata:feedbackValue'],\n };\n if (attributes['genkit:metadata:textFeedback']) {\n metadata['textFeedback'] = truncate(\n attributes['genkit:metadata:textFeedback'] as string\n );\n }\n logger.logStructured(`UserFeedback[${name}]`, metadata);\n }\n\n private writeUserAcceptance(span: ReadableSpan, projectId?: string) {\n const attributes = span.attributes;\n const name = this.extractTraceName(attributes);\n\n const dimensions = {\n name,\n value: attributes['genkit:metadata:acceptanceValue'],\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n };\n this.acceptanceCounter.add(1, dimensions);\n\n const metadata = {\n ...createCommonLogAttributes(span, projectId),\n acceptanceValue: attributes['genkit:metadata:acceptanceValue'],\n };\n logger.logStructured(`UserAcceptance[${name}]`, metadata);\n }\n\n private extractTraceName(attributes: Attributes) {\n const path = attributes['genkit:path'] as string;\n if (!path || path === '<unknown>') {\n return '<unknown>';\n }\n\n const name = path.match('/{(.+)}+');\n return name ? name[1] : '<unknown>';\n }\n}\n\nconst engagementTelemetry = new EngagementTelemetry();\nexport { engagementTelemetry };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,iBAA2C;AAE3C,oBAA+B;AAC/B,qBAAuB;AACvB,qBAIO;AACP,mBAAoD;AAEpD,MAAM,oBAAyC;AAAA;AAAA;AAAA;AAAA,EAIrC,KAAK,2CAA4B,KAAK,MAAM,YAAY;AAAA,EAExD,kBAAkB,IAAI,6BAAc,KAAK,GAAG,UAAU,GAAG;AAAA,IAC/D,aAAa;AAAA,IACb,WAAW,qBAAU;AAAA,EACvB,CAAC;AAAA,EAEO,oBAAoB,IAAI,6BAAc,KAAK,GAAG,YAAY,GAAG;AAAA,IACnE,aAAa;AAAA,IACb,WAAW,qBAAU;AAAA,EACvB,CAAC;AAAA,EAED,KACE,MACA,mBACA,WACM;AACN,UAAM,UAAU,KAAK,WAAW,yBAAyB;AAEzD,QAAI,YAAY,gBAAgB;AAC9B,WAAK,kBAAkB,MAAM,SAAS;AACtC;AAAA,IACF;AAEA,QAAI,YAAY,kBAAkB;AAChC,WAAK,oBAAoB,MAAM,SAAS;AACxC;AAAA,IACF;AAEA,0BAAO,KAAK,oCAAoC,OAAO,EAAE;AAAA,EAC3D;AAAA,EAEQ,kBAAkB,MAAoB,WAAoB;AAChE,UAAM,aAAa,KAAK;AACxB,UAAM,OAAO,KAAK,iBAAiB,UAAU;AAE7C,UAAM,aAAa;AAAA,MACjB;AAAA,MACA,OAAO,WAAW,+BAA+B;AAAA,MACjD,SAAS,CAAC,CAAC,WAAW,8BAA8B;AAAA,MACpD,QAAQ;AAAA,MACR,eAAe;AAAA,IACjB;AACA,SAAK,gBAAgB,IAAI,GAAG,UAAU;AAEtC,UAAM,WAAW;AAAA,MACf,OAAG,wCAA0B,MAAM,SAAS;AAAA,MAC5C,eAAe,WAAW,+BAA+B;AAAA,IAC3D;AACA,QAAI,WAAW,8BAA8B,GAAG;AAC9C,eAAS,cAAc,QAAI;AAAA,QACzB,WAAW,8BAA8B;AAAA,MAC3C;AAAA,IACF;AACA,0BAAO,cAAc,gBAAgB,IAAI,KAAK,QAAQ;AAAA,EACxD;AAAA,EAEQ,oBAAoB,MAAoB,WAAoB;AAClE,UAAM,aAAa,KAAK;AACxB,UAAM,OAAO,KAAK,iBAAiB,UAAU;AAE7C,UAAM,aAAa;AAAA,MACjB;AAAA,MACA,OAAO,WAAW,iCAAiC;AAAA,MACnD,QAAQ;AAAA,MACR,eAAe;AAAA,IACjB;AACA,SAAK,kBAAkB,IAAI,GAAG,UAAU;AAExC,UAAM,WAAW;AAAA,MACf,OAAG,wCAA0B,MAAM,SAAS;AAAA,MAC5C,iBAAiB,WAAW,iCAAiC;AAAA,IAC/D;AACA,0BAAO,cAAc,kBAAkB,IAAI,KAAK,QAAQ;AAAA,EAC1D;AAAA,EAEQ,iBAAiB,YAAwB;AAC/C,UAAM,OAAO,WAAW,aAAa;AACrC,QAAI,CAAC,QAAQ,SAAS,aAAa;AACjC,aAAO;AAAA,IACT;AAEA,UAAM,OAAO,KAAK,MAAM,UAAU;AAClC,WAAO,OAAO,KAAK,CAAC,IAAI;AAAA,EAC1B;AACF;AAEA,MAAM,sBAAsB,IAAI,oBAAoB;","names":[]}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import { ValueType } from "@opentelemetry/api";
|
|
2
|
+
import { GENKIT_VERSION } from "genkit";
|
|
3
|
+
import { logger } from "genkit/logging";
|
|
4
|
+
import {
|
|
5
|
+
MetricCounter,
|
|
6
|
+
internalMetricNamespaceWrap
|
|
7
|
+
} from "../metrics.js";
|
|
8
|
+
import { createCommonLogAttributes, truncate } from "../utils.js";
|
|
9
|
+
class EngagementTelemetry {
|
|
10
|
+
/**
|
|
11
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
12
|
+
*/
|
|
13
|
+
_N = internalMetricNamespaceWrap.bind(null, "engagement");
|
|
14
|
+
feedbackCounter = new MetricCounter(this._N("feedback"), {
|
|
15
|
+
description: "Counts calls to genkit flows.",
|
|
16
|
+
valueType: ValueType.INT
|
|
17
|
+
});
|
|
18
|
+
acceptanceCounter = new MetricCounter(this._N("acceptance"), {
|
|
19
|
+
description: "Tracks unique flow paths per flow.",
|
|
20
|
+
valueType: ValueType.INT
|
|
21
|
+
});
|
|
22
|
+
tick(span, logInputAndOutput, projectId) {
|
|
23
|
+
const subtype = span.attributes["genkit:metadata:subtype"];
|
|
24
|
+
if (subtype === "userFeedback") {
|
|
25
|
+
this.writeUserFeedback(span, projectId);
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
if (subtype === "userAcceptance") {
|
|
29
|
+
this.writeUserAcceptance(span, projectId);
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
logger.warn(`Unknown user engagement subtype: ${subtype}`);
|
|
33
|
+
}
|
|
34
|
+
writeUserFeedback(span, projectId) {
|
|
35
|
+
const attributes = span.attributes;
|
|
36
|
+
const name = this.extractTraceName(attributes);
|
|
37
|
+
const dimensions = {
|
|
38
|
+
name,
|
|
39
|
+
value: attributes["genkit:metadata:feedbackValue"],
|
|
40
|
+
hasText: !!attributes["genkit:metadata:textFeedback"],
|
|
41
|
+
source: "ts",
|
|
42
|
+
sourceVersion: GENKIT_VERSION
|
|
43
|
+
};
|
|
44
|
+
this.feedbackCounter.add(1, dimensions);
|
|
45
|
+
const metadata = {
|
|
46
|
+
...createCommonLogAttributes(span, projectId),
|
|
47
|
+
feedbackValue: attributes["genkit:metadata:feedbackValue"]
|
|
48
|
+
};
|
|
49
|
+
if (attributes["genkit:metadata:textFeedback"]) {
|
|
50
|
+
metadata["textFeedback"] = truncate(
|
|
51
|
+
attributes["genkit:metadata:textFeedback"]
|
|
52
|
+
);
|
|
53
|
+
}
|
|
54
|
+
logger.logStructured(`UserFeedback[${name}]`, metadata);
|
|
55
|
+
}
|
|
56
|
+
writeUserAcceptance(span, projectId) {
|
|
57
|
+
const attributes = span.attributes;
|
|
58
|
+
const name = this.extractTraceName(attributes);
|
|
59
|
+
const dimensions = {
|
|
60
|
+
name,
|
|
61
|
+
value: attributes["genkit:metadata:acceptanceValue"],
|
|
62
|
+
source: "ts",
|
|
63
|
+
sourceVersion: GENKIT_VERSION
|
|
64
|
+
};
|
|
65
|
+
this.acceptanceCounter.add(1, dimensions);
|
|
66
|
+
const metadata = {
|
|
67
|
+
...createCommonLogAttributes(span, projectId),
|
|
68
|
+
acceptanceValue: attributes["genkit:metadata:acceptanceValue"]
|
|
69
|
+
};
|
|
70
|
+
logger.logStructured(`UserAcceptance[${name}]`, metadata);
|
|
71
|
+
}
|
|
72
|
+
extractTraceName(attributes) {
|
|
73
|
+
const path = attributes["genkit:path"];
|
|
74
|
+
if (!path || path === "<unknown>") {
|
|
75
|
+
return "<unknown>";
|
|
76
|
+
}
|
|
77
|
+
const name = path.match("/{(.+)}+");
|
|
78
|
+
return name ? name[1] : "<unknown>";
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
const engagementTelemetry = new EngagementTelemetry();
|
|
82
|
+
export {
|
|
83
|
+
engagementTelemetry
|
|
84
|
+
};
|
|
85
|
+
//# sourceMappingURL=engagement.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/engagement.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ValueType, type Attributes } from '@opentelemetry/api';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { GENKIT_VERSION } from 'genkit';\nimport { logger } from 'genkit/logging';\nimport {\n MetricCounter,\n internalMetricNamespaceWrap,\n type Telemetry,\n} from '../metrics.js';\nimport { createCommonLogAttributes, truncate } from '../utils.js';\n\nclass EngagementTelemetry implements Telemetry {\n /**\n * Wraps the declared metrics in a Genkit-specific, internal namespace.\n */\n private _N = internalMetricNamespaceWrap.bind(null, 'engagement');\n\n private feedbackCounter = new MetricCounter(this._N('feedback'), {\n description: 'Counts calls to genkit flows.',\n valueType: ValueType.INT,\n });\n\n private acceptanceCounter = new MetricCounter(this._N('acceptance'), {\n description: 'Tracks unique flow paths per flow.',\n valueType: ValueType.INT,\n });\n\n tick(\n span: ReadableSpan,\n logInputAndOutput: boolean,\n projectId?: string\n ): void {\n const subtype = span.attributes['genkit:metadata:subtype'] as string;\n\n if (subtype === 'userFeedback') {\n this.writeUserFeedback(span, projectId);\n return;\n }\n\n if (subtype === 'userAcceptance') {\n this.writeUserAcceptance(span, projectId);\n return;\n }\n\n logger.warn(`Unknown user engagement subtype: ${subtype}`);\n }\n\n private writeUserFeedback(span: ReadableSpan, projectId?: string) {\n const attributes = span.attributes;\n const name = this.extractTraceName(attributes);\n\n const dimensions = {\n name,\n value: attributes['genkit:metadata:feedbackValue'],\n hasText: !!attributes['genkit:metadata:textFeedback'],\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n };\n this.feedbackCounter.add(1, dimensions);\n\n const metadata = {\n ...createCommonLogAttributes(span, projectId),\n feedbackValue: attributes['genkit:metadata:feedbackValue'],\n };\n if (attributes['genkit:metadata:textFeedback']) {\n metadata['textFeedback'] = truncate(\n attributes['genkit:metadata:textFeedback'] as string\n );\n }\n logger.logStructured(`UserFeedback[${name}]`, metadata);\n }\n\n private writeUserAcceptance(span: ReadableSpan, projectId?: string) {\n const attributes = span.attributes;\n const name = this.extractTraceName(attributes);\n\n const dimensions = {\n name,\n value: attributes['genkit:metadata:acceptanceValue'],\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n };\n this.acceptanceCounter.add(1, dimensions);\n\n const metadata = {\n ...createCommonLogAttributes(span, projectId),\n acceptanceValue: attributes['genkit:metadata:acceptanceValue'],\n };\n logger.logStructured(`UserAcceptance[${name}]`, metadata);\n }\n\n private extractTraceName(attributes: Attributes) {\n const path = attributes['genkit:path'] as string;\n if (!path || path === '<unknown>') {\n return '<unknown>';\n }\n\n const name = path.match('/{(.+)}+');\n return name ? name[1] : '<unknown>';\n }\n}\n\nconst engagementTelemetry = new EngagementTelemetry();\nexport { engagementTelemetry };\n"],"mappings":"AAgBA,SAAS,iBAAkC;AAE3C,SAAS,sBAAsB;AAC/B,SAAS,cAAc;AACvB;AAAA,EACE;AAAA,EACA;AAAA,OAEK;AACP,SAAS,2BAA2B,gBAAgB;AAEpD,MAAM,oBAAyC;AAAA;AAAA;AAAA;AAAA,EAIrC,KAAK,4BAA4B,KAAK,MAAM,YAAY;AAAA,EAExD,kBAAkB,IAAI,cAAc,KAAK,GAAG,UAAU,GAAG;AAAA,IAC/D,aAAa;AAAA,IACb,WAAW,UAAU;AAAA,EACvB,CAAC;AAAA,EAEO,oBAAoB,IAAI,cAAc,KAAK,GAAG,YAAY,GAAG;AAAA,IACnE,aAAa;AAAA,IACb,WAAW,UAAU;AAAA,EACvB,CAAC;AAAA,EAED,KACE,MACA,mBACA,WACM;AACN,UAAM,UAAU,KAAK,WAAW,yBAAyB;AAEzD,QAAI,YAAY,gBAAgB;AAC9B,WAAK,kBAAkB,MAAM,SAAS;AACtC;AAAA,IACF;AAEA,QAAI,YAAY,kBAAkB;AAChC,WAAK,oBAAoB,MAAM,SAAS;AACxC;AAAA,IACF;AAEA,WAAO,KAAK,oCAAoC,OAAO,EAAE;AAAA,EAC3D;AAAA,EAEQ,kBAAkB,MAAoB,WAAoB;AAChE,UAAM,a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ry/sdk-trace-base';
|
|
2
|
+
import { Telemetry } from '../metrics.mjs';
|
|
3
|
+
import '@opentelemetry/api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright 2024 Google LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare class FeaturesTelemetry implements Telemetry {
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
24
|
+
*/
|
|
25
|
+
private _N;
|
|
26
|
+
private featureCounter;
|
|
27
|
+
private featureLatencies;
|
|
28
|
+
tick(span: ReadableSpan, logInputAndOutput: boolean, projectId?: string): void;
|
|
29
|
+
private writeFeatureSuccess;
|
|
30
|
+
private writeFeatureFailure;
|
|
31
|
+
private writeLog;
|
|
32
|
+
}
|
|
33
|
+
declare const featuresTelemetry: FeaturesTelemetry;
|
|
34
|
+
|
|
35
|
+
export { featuresTelemetry };
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { ReadableSpan } from '@opentelemetry/sdk-trace-base';
|
|
2
|
+
import { Telemetry } from '../metrics.js';
|
|
3
|
+
import '@opentelemetry/api';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Copyright 2024 Google LLC
|
|
7
|
+
*
|
|
8
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
9
|
+
* you may not use this file except in compliance with the License.
|
|
10
|
+
* You may obtain a copy of the License at
|
|
11
|
+
*
|
|
12
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
13
|
+
*
|
|
14
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
15
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
16
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
17
|
+
* See the License for the specific language governing permissions and
|
|
18
|
+
* limitations under the License.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
declare class FeaturesTelemetry implements Telemetry {
|
|
22
|
+
/**
|
|
23
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
24
|
+
*/
|
|
25
|
+
private _N;
|
|
26
|
+
private featureCounter;
|
|
27
|
+
private featureLatencies;
|
|
28
|
+
tick(span: ReadableSpan, logInputAndOutput: boolean, projectId?: string): void;
|
|
29
|
+
private writeFeatureSuccess;
|
|
30
|
+
private writeFeatureFailure;
|
|
31
|
+
private writeLog;
|
|
32
|
+
}
|
|
33
|
+
declare const featuresTelemetry: FeaturesTelemetry;
|
|
34
|
+
|
|
35
|
+
export { featuresTelemetry };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var feature_exports = {};
|
|
20
|
+
__export(feature_exports, {
|
|
21
|
+
featuresTelemetry: () => featuresTelemetry
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(feature_exports);
|
|
24
|
+
var import_api = require("@opentelemetry/api");
|
|
25
|
+
var import_core = require("@opentelemetry/core");
|
|
26
|
+
var import_genkit = require("genkit");
|
|
27
|
+
var import_logging = require("genkit/logging");
|
|
28
|
+
var import_tracing = require("genkit/tracing");
|
|
29
|
+
var import_metrics = require("../metrics.js");
|
|
30
|
+
var import_utils = require("../utils.js");
|
|
31
|
+
class FeaturesTelemetry {
|
|
32
|
+
/**
|
|
33
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
34
|
+
*/
|
|
35
|
+
_N = import_metrics.internalMetricNamespaceWrap.bind(null, "feature");
|
|
36
|
+
featureCounter = new import_metrics.MetricCounter(this._N("requests"), {
|
|
37
|
+
description: "Counts calls to genkit features.",
|
|
38
|
+
valueType: import_api.ValueType.INT
|
|
39
|
+
});
|
|
40
|
+
featureLatencies = new import_metrics.MetricHistogram(this._N("latency"), {
|
|
41
|
+
description: "Latencies when calling Genkit features.",
|
|
42
|
+
valueType: import_api.ValueType.DOUBLE,
|
|
43
|
+
unit: "ms"
|
|
44
|
+
});
|
|
45
|
+
tick(span, logInputAndOutput, projectId) {
|
|
46
|
+
const attributes = span.attributes;
|
|
47
|
+
const name = attributes["genkit:name"];
|
|
48
|
+
const path = attributes["genkit:path"];
|
|
49
|
+
const latencyMs = (0, import_core.hrTimeToMilliseconds)(
|
|
50
|
+
(0, import_core.hrTimeDuration)(span.startTime, span.endTime)
|
|
51
|
+
);
|
|
52
|
+
const isRoot = attributes["genkit:isRoot"];
|
|
53
|
+
if (!isRoot) {
|
|
54
|
+
throw new import_genkit.GenkitError({
|
|
55
|
+
status: "FAILED_PRECONDITION",
|
|
56
|
+
message: "FeatureTelemetry tick called with non-root span."
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
const state = attributes["genkit:state"];
|
|
60
|
+
if (state === "success") {
|
|
61
|
+
this.writeFeatureSuccess(name, latencyMs);
|
|
62
|
+
} else if (state === "error") {
|
|
63
|
+
const errorName = (0, import_utils.extractErrorName)(span.events) || "<unknown>";
|
|
64
|
+
this.writeFeatureFailure(name, latencyMs, errorName);
|
|
65
|
+
} else {
|
|
66
|
+
import_logging.logger.warn(`Unknown state; ${state}`);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
if (logInputAndOutput) {
|
|
70
|
+
const input = (0, import_utils.truncate)(attributes["genkit:input"]);
|
|
71
|
+
const output = (0, import_utils.truncate)(attributes["genkit:output"]);
|
|
72
|
+
const sessionId = attributes["genkit:sessionId"];
|
|
73
|
+
const threadName = attributes["genkit:threadName"];
|
|
74
|
+
if (input) {
|
|
75
|
+
this.writeLog(
|
|
76
|
+
span,
|
|
77
|
+
"Input",
|
|
78
|
+
name,
|
|
79
|
+
path,
|
|
80
|
+
input,
|
|
81
|
+
projectId,
|
|
82
|
+
sessionId,
|
|
83
|
+
threadName
|
|
84
|
+
);
|
|
85
|
+
}
|
|
86
|
+
if (output) {
|
|
87
|
+
this.writeLog(
|
|
88
|
+
span,
|
|
89
|
+
"Output",
|
|
90
|
+
name,
|
|
91
|
+
path,
|
|
92
|
+
output,
|
|
93
|
+
projectId,
|
|
94
|
+
sessionId,
|
|
95
|
+
threadName
|
|
96
|
+
);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
writeFeatureSuccess(featureName, latencyMs) {
|
|
101
|
+
const dimensions = {
|
|
102
|
+
name: featureName,
|
|
103
|
+
status: "success",
|
|
104
|
+
source: "ts",
|
|
105
|
+
sourceVersion: import_genkit.GENKIT_VERSION
|
|
106
|
+
};
|
|
107
|
+
this.featureCounter.add(1, dimensions);
|
|
108
|
+
this.featureLatencies.record(latencyMs, dimensions);
|
|
109
|
+
}
|
|
110
|
+
writeFeatureFailure(featureName, latencyMs, errorName) {
|
|
111
|
+
const dimensions = {
|
|
112
|
+
name: featureName,
|
|
113
|
+
status: "failure",
|
|
114
|
+
source: "ts",
|
|
115
|
+
sourceVersion: import_genkit.GENKIT_VERSION,
|
|
116
|
+
error: errorName
|
|
117
|
+
};
|
|
118
|
+
this.featureCounter.add(1, dimensions);
|
|
119
|
+
this.featureLatencies.record(latencyMs, dimensions);
|
|
120
|
+
}
|
|
121
|
+
writeLog(span, tag, featureName, qualifiedPath, content, projectId, sessionId, threadName) {
|
|
122
|
+
const path = (0, import_utils.truncatePath)((0, import_tracing.toDisplayPath)(qualifiedPath));
|
|
123
|
+
const sharedMetadata = {
|
|
124
|
+
...(0, import_utils.createCommonLogAttributes)(span, projectId),
|
|
125
|
+
path,
|
|
126
|
+
qualifiedPath,
|
|
127
|
+
featureName,
|
|
128
|
+
sessionId,
|
|
129
|
+
threadName
|
|
130
|
+
};
|
|
131
|
+
import_logging.logger.logStructured(`${tag}[${path}, ${featureName}]`, {
|
|
132
|
+
...sharedMetadata,
|
|
133
|
+
content
|
|
134
|
+
});
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
const featuresTelemetry = new FeaturesTelemetry();
|
|
138
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
139
|
+
0 && (module.exports = {
|
|
140
|
+
featuresTelemetry
|
|
141
|
+
});
|
|
142
|
+
//# sourceMappingURL=feature.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/feature.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ValueType } from '@opentelemetry/api';\nimport { hrTimeDuration, hrTimeToMilliseconds } from '@opentelemetry/core';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { GENKIT_VERSION, GenkitError } from 'genkit';\nimport { logger } from 'genkit/logging';\nimport { toDisplayPath } from 'genkit/tracing';\nimport {\n MetricCounter,\n MetricHistogram,\n internalMetricNamespaceWrap,\n type Telemetry,\n} from '../metrics.js';\nimport {\n createCommonLogAttributes,\n extractErrorName,\n truncate,\n truncatePath,\n} from '../utils.js';\n\nclass FeaturesTelemetry implements Telemetry {\n /**\n * Wraps the declared metrics in a Genkit-specific, internal namespace.\n */\n private _N = internalMetricNamespaceWrap.bind(null, 'feature');\n\n private featureCounter = new MetricCounter(this._N('requests'), {\n description: 'Counts calls to genkit features.',\n valueType: ValueType.INT,\n });\n\n private featureLatencies = new MetricHistogram(this._N('latency'), {\n description: 'Latencies when calling Genkit features.',\n valueType: ValueType.DOUBLE,\n unit: 'ms',\n });\n\n tick(\n span: ReadableSpan,\n logInputAndOutput: boolean,\n projectId?: string\n ): void {\n const attributes = span.attributes;\n const name = attributes['genkit:name'] as string;\n const path = attributes['genkit:path'] as string;\n const latencyMs = hrTimeToMilliseconds(\n hrTimeDuration(span.startTime, span.endTime)\n );\n const isRoot = attributes['genkit:isRoot'] as boolean;\n if (!isRoot) {\n throw new GenkitError({\n status: 'FAILED_PRECONDITION',\n message: 'FeatureTelemetry tick called with non-root span.',\n });\n }\n const state = attributes['genkit:state'] as string;\n\n if (state === 'success') {\n this.writeFeatureSuccess(name, latencyMs);\n } else if (state === 'error') {\n const errorName = extractErrorName(span.events) || '<unknown>';\n this.writeFeatureFailure(name, latencyMs, errorName);\n } else {\n logger.warn(`Unknown state; ${state}`);\n return;\n }\n\n if (logInputAndOutput) {\n const input = truncate(attributes['genkit:input'] as string);\n const output = truncate(attributes['genkit:output'] as string);\n const sessionId = attributes['genkit:sessionId'] as string;\n const threadName = attributes['genkit:threadName'] as string;\n\n if (input) {\n this.writeLog(\n span,\n 'Input',\n name,\n path,\n input,\n projectId,\n sessionId,\n threadName\n );\n }\n if (output) {\n this.writeLog(\n span,\n 'Output',\n name,\n path,\n output,\n projectId,\n sessionId,\n threadName\n );\n }\n }\n }\n\n private writeFeatureSuccess(featureName: string, latencyMs: number) {\n const dimensions = {\n name: featureName,\n status: 'success',\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n };\n this.featureCounter.add(1, dimensions);\n this.featureLatencies.record(latencyMs, dimensions);\n }\n\n private writeFeatureFailure(\n featureName: string,\n latencyMs: number,\n errorName: string\n ) {\n const dimensions = {\n name: featureName,\n status: 'failure',\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n error: errorName,\n };\n this.featureCounter.add(1, dimensions);\n this.featureLatencies.record(latencyMs, dimensions);\n }\n\n private writeLog(\n span: ReadableSpan,\n tag: string,\n featureName: string,\n qualifiedPath: string,\n content: string,\n projectId?: string,\n sessionId?: string,\n threadName?: string\n ) {\n const path = truncatePath(toDisplayPath(qualifiedPath));\n const sharedMetadata = {\n ...createCommonLogAttributes(span, projectId),\n path,\n qualifiedPath,\n featureName,\n sessionId,\n threadName,\n };\n logger.logStructured(`${tag}[${path}, ${featureName}]`, {\n ...sharedMetadata,\n content,\n });\n }\n}\n\nconst featuresTelemetry = new FeaturesTelemetry();\nexport { featuresTelemetry };\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAgBA,iBAA0B;AAC1B,kBAAqD;AAErD,oBAA4C;AAC5C,qBAAuB;AACvB,qBAA8B;AAC9B,qBAKO;AACP,mBAKO;AAEP,MAAM,kBAAuC;AAAA;AAAA;AAAA;AAAA,EAInC,KAAK,2CAA4B,KAAK,MAAM,SAAS;AAAA,EAErD,i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A,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EAEQ,oBAAoB,aAAqB,WAAmB;AAClE,UAAM,aAAa;AAAA,MACjB,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,eAAe;AAAA,IACjB;AACA,SAAK,eAAe,IAAI,GAAG,UAAU;AACrC,SAAK,iBAAiB,OAAO,WAAW,UAAU;AAAA,EACpD;AAAA,EAEQ,oBACN,aACA,WACA,WACA;AACA,UAAM,aAAa;AAAA,MACjB,MAAM;AAAA,MACN,QAAQ;AAAA,MACR,QAAQ;AAAA,MACR,eAAe;AAAA,MACf,OAAO;AAAA,IACT;AACA,SAAK,eAAe,IAAI,GAAG,UAAU;AACrC,SAAK,iBAAiB,OAAO,WAAW,UAAU;AAAA,EACpD;AAAA,EAEQ,SACN,MACA,KACA,aACA,eACA,SACA,WACA,WACA,YACA;AACA,UAAM,WAAO,+BAAa,8BAAc,aAAa,CAAC;AACtD,UAAM,iBAAiB;AAAA,MACrB,OAAG,wCAA0B,MAAM,SAAS;AAAA,MAC5C;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IACF;AACA,0BAAO,cAAc,GAAG,GAAG,IAAI,IAAI,KAAK,WAAW,KAAK;AAAA,MACtD,GAAG;AAAA,MACH;AAAA,IACF,CAAC;AAAA,EACH;AACF;AAEA,MAAM,oBAAoB,IAAI,kBAAkB;","names":[]}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { ValueType } from "@opentelemetry/api";
|
|
2
|
+
import { hrTimeDuration, hrTimeToMilliseconds } from "@opentelemetry/core";
|
|
3
|
+
import { GENKIT_VERSION, GenkitError } from "genkit";
|
|
4
|
+
import { logger } from "genkit/logging";
|
|
5
|
+
import { toDisplayPath } from "genkit/tracing";
|
|
6
|
+
import {
|
|
7
|
+
MetricCounter,
|
|
8
|
+
MetricHistogram,
|
|
9
|
+
internalMetricNamespaceWrap
|
|
10
|
+
} from "../metrics.js";
|
|
11
|
+
import {
|
|
12
|
+
createCommonLogAttributes,
|
|
13
|
+
extractErrorName,
|
|
14
|
+
truncate,
|
|
15
|
+
truncatePath
|
|
16
|
+
} from "../utils.js";
|
|
17
|
+
class FeaturesTelemetry {
|
|
18
|
+
/**
|
|
19
|
+
* Wraps the declared metrics in a Genkit-specific, internal namespace.
|
|
20
|
+
*/
|
|
21
|
+
_N = internalMetricNamespaceWrap.bind(null, "feature");
|
|
22
|
+
featureCounter = new MetricCounter(this._N("requests"), {
|
|
23
|
+
description: "Counts calls to genkit features.",
|
|
24
|
+
valueType: ValueType.INT
|
|
25
|
+
});
|
|
26
|
+
featureLatencies = new MetricHistogram(this._N("latency"), {
|
|
27
|
+
description: "Latencies when calling Genkit features.",
|
|
28
|
+
valueType: ValueType.DOUBLE,
|
|
29
|
+
unit: "ms"
|
|
30
|
+
});
|
|
31
|
+
tick(span, logInputAndOutput, projectId) {
|
|
32
|
+
const attributes = span.attributes;
|
|
33
|
+
const name = attributes["genkit:name"];
|
|
34
|
+
const path = attributes["genkit:path"];
|
|
35
|
+
const latencyMs = hrTimeToMilliseconds(
|
|
36
|
+
hrTimeDuration(span.startTime, span.endTime)
|
|
37
|
+
);
|
|
38
|
+
const isRoot = attributes["genkit:isRoot"];
|
|
39
|
+
if (!isRoot) {
|
|
40
|
+
throw new GenkitError({
|
|
41
|
+
status: "FAILED_PRECONDITION",
|
|
42
|
+
message: "FeatureTelemetry tick called with non-root span."
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
const state = attributes["genkit:state"];
|
|
46
|
+
if (state === "success") {
|
|
47
|
+
this.writeFeatureSuccess(name, latencyMs);
|
|
48
|
+
} else if (state === "error") {
|
|
49
|
+
const errorName = extractErrorName(span.events) || "<unknown>";
|
|
50
|
+
this.writeFeatureFailure(name, latencyMs, errorName);
|
|
51
|
+
} else {
|
|
52
|
+
logger.warn(`Unknown state; ${state}`);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
if (logInputAndOutput) {
|
|
56
|
+
const input = truncate(attributes["genkit:input"]);
|
|
57
|
+
const output = truncate(attributes["genkit:output"]);
|
|
58
|
+
const sessionId = attributes["genkit:sessionId"];
|
|
59
|
+
const threadName = attributes["genkit:threadName"];
|
|
60
|
+
if (input) {
|
|
61
|
+
this.writeLog(
|
|
62
|
+
span,
|
|
63
|
+
"Input",
|
|
64
|
+
name,
|
|
65
|
+
path,
|
|
66
|
+
input,
|
|
67
|
+
projectId,
|
|
68
|
+
sessionId,
|
|
69
|
+
threadName
|
|
70
|
+
);
|
|
71
|
+
}
|
|
72
|
+
if (output) {
|
|
73
|
+
this.writeLog(
|
|
74
|
+
span,
|
|
75
|
+
"Output",
|
|
76
|
+
name,
|
|
77
|
+
path,
|
|
78
|
+
output,
|
|
79
|
+
projectId,
|
|
80
|
+
sessionId,
|
|
81
|
+
threadName
|
|
82
|
+
);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
writeFeatureSuccess(featureName, latencyMs) {
|
|
87
|
+
const dimensions = {
|
|
88
|
+
name: featureName,
|
|
89
|
+
status: "success",
|
|
90
|
+
source: "ts",
|
|
91
|
+
sourceVersion: GENKIT_VERSION
|
|
92
|
+
};
|
|
93
|
+
this.featureCounter.add(1, dimensions);
|
|
94
|
+
this.featureLatencies.record(latencyMs, dimensions);
|
|
95
|
+
}
|
|
96
|
+
writeFeatureFailure(featureName, latencyMs, errorName) {
|
|
97
|
+
const dimensions = {
|
|
98
|
+
name: featureName,
|
|
99
|
+
status: "failure",
|
|
100
|
+
source: "ts",
|
|
101
|
+
sourceVersion: GENKIT_VERSION,
|
|
102
|
+
error: errorName
|
|
103
|
+
};
|
|
104
|
+
this.featureCounter.add(1, dimensions);
|
|
105
|
+
this.featureLatencies.record(latencyMs, dimensions);
|
|
106
|
+
}
|
|
107
|
+
writeLog(span, tag, featureName, qualifiedPath, content, projectId, sessionId, threadName) {
|
|
108
|
+
const path = truncatePath(toDisplayPath(qualifiedPath));
|
|
109
|
+
const sharedMetadata = {
|
|
110
|
+
...createCommonLogAttributes(span, projectId),
|
|
111
|
+
path,
|
|
112
|
+
qualifiedPath,
|
|
113
|
+
featureName,
|
|
114
|
+
sessionId,
|
|
115
|
+
threadName
|
|
116
|
+
};
|
|
117
|
+
logger.logStructured(`${tag}[${path}, ${featureName}]`, {
|
|
118
|
+
...sharedMetadata,
|
|
119
|
+
content
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
const featuresTelemetry = new FeaturesTelemetry();
|
|
124
|
+
export {
|
|
125
|
+
featuresTelemetry
|
|
126
|
+
};
|
|
127
|
+
//# sourceMappingURL=feature.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/telemetry/feature.ts"],"sourcesContent":["/**\n * Copyright 2024 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport { ValueType } from '@opentelemetry/api';\nimport { hrTimeDuration, hrTimeToMilliseconds } from '@opentelemetry/core';\nimport type { ReadableSpan } from '@opentelemetry/sdk-trace-base';\nimport { GENKIT_VERSION, GenkitError } from 'genkit';\nimport { logger } from 'genkit/logging';\nimport { toDisplayPath } from 'genkit/tracing';\nimport {\n MetricCounter,\n MetricHistogram,\n internalMetricNamespaceWrap,\n type Telemetry,\n} from '../metrics.js';\nimport {\n createCommonLogAttributes,\n extractErrorName,\n truncate,\n truncatePath,\n} from '../utils.js';\n\nclass FeaturesTelemetry implements Telemetry {\n /**\n * Wraps the declared metrics in a Genkit-specific, internal namespace.\n */\n private _N = internalMetricNamespaceWrap.bind(null, 'feature');\n\n private featureCounter = new MetricCounter(this._N('requests'), {\n description: 'Counts calls to genkit features.',\n valueType: ValueType.INT,\n });\n\n private featureLatencies = new MetricHistogram(this._N('latency'), {\n description: 'Latencies when calling Genkit features.',\n valueType: ValueType.DOUBLE,\n unit: 'ms',\n });\n\n tick(\n span: ReadableSpan,\n logInputAndOutput: boolean,\n projectId?: string\n ): void {\n const attributes = span.attributes;\n const name = attributes['genkit:name'] as string;\n const path = attributes['genkit:path'] as string;\n const latencyMs = hrTimeToMilliseconds(\n hrTimeDuration(span.startTime, span.endTime)\n );\n const isRoot = attributes['genkit:isRoot'] as boolean;\n if (!isRoot) {\n throw new GenkitError({\n status: 'FAILED_PRECONDITION',\n message: 'FeatureTelemetry tick called with non-root span.',\n });\n }\n const state = attributes['genkit:state'] as string;\n\n if (state === 'success') {\n this.writeFeatureSuccess(name, latencyMs);\n } else if (state === 'error') {\n const errorName = extractErrorName(span.events) || '<unknown>';\n this.writeFeatureFailure(name, latencyMs, errorName);\n } else {\n logger.warn(`Unknown state; ${state}`);\n return;\n }\n\n if (logInputAndOutput) {\n const input = truncate(attributes['genkit:input'] as string);\n const output = truncate(attributes['genkit:output'] as string);\n const sessionId = attributes['genkit:sessionId'] as string;\n const threadName = attributes['genkit:threadName'] as string;\n\n if (input) {\n this.writeLog(\n span,\n 'Input',\n name,\n path,\n input,\n projectId,\n sessionId,\n threadName\n );\n }\n if (output) {\n this.writeLog(\n span,\n 'Output',\n name,\n path,\n output,\n projectId,\n sessionId,\n threadName\n );\n }\n }\n }\n\n private writeFeatureSuccess(featureName: string, latencyMs: number) {\n const dimensions = {\n name: featureName,\n status: 'success',\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n };\n this.featureCounter.add(1, dimensions);\n this.featureLatencies.record(latencyMs, dimensions);\n }\n\n private writeFeatureFailure(\n featureName: string,\n latencyMs: number,\n errorName: string\n ) {\n const dimensions = {\n name: featureName,\n status: 'failure',\n source: 'ts',\n sourceVersion: GENKIT_VERSION,\n error: errorName,\n };\n this.featureCounter.add(1, dimensions);\n this.featureLatencies.record(latencyMs, dimensions);\n }\n\n private writeLog(\n span: ReadableSpan,\n tag: string,\n featureName: string,\n qualifiedPath: string,\n content: string,\n projectId?: string,\n sessionId?: string,\n threadName?: string\n ) {\n const path = truncatePath(toDisplayPath(qualifiedPath));\n const sharedMetadata = {\n ...createCommonLogAttributes(span, projectId),\n path,\n qualifiedPath,\n featureName,\n sessionId,\n threadName,\n };\n logger.logStructured(`${tag}[${path}, ${featureName}]`, {\n ...sharedMetadata,\n content,\n });\n }\n}\n\nconst featuresTelemetry = new FeaturesTelemetry();\nexport { featuresTelemetry };\n"],"mappings":"AAgBA,SAAS,iBAAiB;AAC1B,SAAS,gBAAgB,4BAA4B;AAErD,SAAS,gBAAgB,mBAAmB;AAC5C,SAAS,cAAc;AACvB,SAAS,qBAAqB;AAC9B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AACP;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AAEP,MAAM,kBAAuC;AAAA;AAAA;AAAA;AAAA,EAInC,KAAK,4BAA4B,KAAK,MAAM,SAAS;AAAA,EAErD,iBAAiB,IAAI,cAAc,KAAK,GAAG,UAAU,GAAG;AAAA,IAC9D,aAAa;AAAA,IACb,WAAW,UAAU;AAAA,EACvB,CAAC;AAAA,EAEO,mBAAmB,IAAI,gBAAgB,KAAK,GAAG,SAAS,GAAG;AAAA,IACjE,aAAa;AAAA,IACb,WAAW,UAAU;AAAA,IACrB,MAAM;AAAA,EACR,CAAC;AAAA,EAED,KACE,MACA,mBACA,WACM;AACN,UAAM,aAAa,KAAK;AACxB,UAAM,OAAO,WAAW,aAAa;AACrC,UAAM,OAAO,WAAW,aAAa;AACrC,UAAM,YAAY;AAAA,MAChB,eAAe,KAAK,WAAW,KAAK,OAAO;AAAA,IAC7C;AACA,UAAM,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