genkit-google-cloud 0.9.0__tar.gz
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.
- genkit_google_cloud-0.9.0/.gitignore +36 -0
- genkit_google_cloud-0.9.0/LICENSE +201 -0
- genkit_google_cloud-0.9.0/PARITY_ANALYSIS.md +344 -0
- genkit_google_cloud-0.9.0/PKG-INFO +63 -0
- genkit_google_cloud-0.9.0/README.md +23 -0
- genkit_google_cloud-0.9.0/pyproject.toml +83 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/__init__.py +64 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/py.typed +0 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/__init__.py +45 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/action.py +126 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/config.py +318 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/constants.py +50 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/engagement.py +171 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/exporters.py +112 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/feature.py +186 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/gcp_logger.py +246 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/generate.py +562 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/metrics.py +246 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/metrics_exporter.py +153 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/path.py +157 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/trace_exporter.py +254 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/tracing.py +198 -0
- genkit_google_cloud-0.9.0/src/genkit_google_cloud/telemetry/utils.py +189 -0
- genkit_google_cloud-0.9.0/tests/gcp_telemetry_metrics_test.py +97 -0
- genkit_google_cloud-0.9.0/tests/gcp_telemetry_utils_test.py +342 -0
- genkit_google_cloud-0.9.0/tests/tracing_test.py +391 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
*$py.class
|
|
2
|
+
*.egg
|
|
3
|
+
*.egg-info/
|
|
4
|
+
*.py[cod]
|
|
5
|
+
*.so
|
|
6
|
+
.DS_Store
|
|
7
|
+
.Python
|
|
8
|
+
.cache/
|
|
9
|
+
.coverage
|
|
10
|
+
.eggs/
|
|
11
|
+
.genkit
|
|
12
|
+
.idea/
|
|
13
|
+
.installed.cfg
|
|
14
|
+
.mypy_cache/
|
|
15
|
+
.pytest_cache/
|
|
16
|
+
.ruff_cache/
|
|
17
|
+
.venv
|
|
18
|
+
ENV/
|
|
19
|
+
__pycache__/
|
|
20
|
+
build/
|
|
21
|
+
develop-eggs/
|
|
22
|
+
dist/
|
|
23
|
+
downloads/
|
|
24
|
+
eggs/
|
|
25
|
+
lib/
|
|
26
|
+
lib64/
|
|
27
|
+
parts/
|
|
28
|
+
sdist/
|
|
29
|
+
site/
|
|
30
|
+
var/
|
|
31
|
+
venv/
|
|
32
|
+
wheels/
|
|
33
|
+
.gemini/artifacts/
|
|
34
|
+
|
|
35
|
+
*.bak
|
|
36
|
+
release-manifest.json
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2025 Google LLC
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
|
@@ -0,0 +1,344 @@
|
|
|
1
|
+
# GCP Telemetry Parity Analysis
|
|
2
|
+
|
|
3
|
+
This document provides a comprehensive cross-language parity analysis of the Genkit GCP telemetry implementations across JavaScript, Go, and Python, verified against official Google Cloud documentation.
|
|
4
|
+
|
|
5
|
+
## Summary
|
|
6
|
+
|
|
7
|
+
| Category | JS | Go | Python | Status |
|
|
8
|
+
|----------|----|----|--------|--------|
|
|
9
|
+
| Configuration Options | ✅ | ✅ | ✅ | **PARITY** |
|
|
10
|
+
| Metrics (names, types) | ✅ | ✅ | ✅ | **PARITY** |
|
|
11
|
+
| Metric Dimensions | ✅ | ✅ | ✅ | **PARITY** (fixed) |
|
|
12
|
+
| Log Formats | ✅ | ✅ | ✅ | **PARITY** |
|
|
13
|
+
| Span Attributes | ✅ | ✅ | ✅ | **PARITY** |
|
|
14
|
+
| Error Handling | ✅ | ✅ | ✅ | **PARITY** |
|
|
15
|
+
| Constants/Limits | ✅ | ✅ | ✅ | **PARITY** (fixed) |
|
|
16
|
+
|
|
17
|
+
***
|
|
18
|
+
|
|
19
|
+
## 1. Configuration Options Comparison
|
|
20
|
+
|
|
21
|
+
### Main Configuration
|
|
22
|
+
|
|
23
|
+
| Option | JS | Go | Python | GCP Docs | Notes |
|
|
24
|
+
|--------|----|----|--------|----------|-------|
|
|
25
|
+
| `projectId` | ✅ | ✅ | ✅ | ✅ | All support auto-detection |
|
|
26
|
+
| `credentials` | ✅ | ✅ | ✅ | ✅ | ADC fallback |
|
|
27
|
+
| `sampler` | ✅ | ✅ | ✅ | ✅ | OpenTelemetry sampler |
|
|
28
|
+
| `disableMetrics` | ✅ | ✅ | ✅ | N/A | - |
|
|
29
|
+
| `disableTraces` | ✅ | ✅ | ✅ | N/A | - |
|
|
30
|
+
| `disableLoggingInputAndOutput` | ✅ (inverted) | ✅ (inverted) | ✅ (`log_input_and_output`) | N/A | Python uses positive flag |
|
|
31
|
+
| `forceDevExport` | ✅ | ✅ | ✅ | N/A | - |
|
|
32
|
+
| `metricExportIntervalMillis` | ✅ | ✅ | ✅ | ✅ (min 5s) | All enforce 5000ms min |
|
|
33
|
+
| `metricExportTimeoutMillis` | ✅ | ✅ | ✅ | N/A | - |
|
|
34
|
+
| `autoInstrumentation` | ✅ | ❌ | ❌ | N/A | JS-specific |
|
|
35
|
+
| `instrumentations` | ✅ | ❌ | ❌ | N/A | JS-specific |
|
|
36
|
+
|
|
37
|
+
### Project ID Resolution Order
|
|
38
|
+
|
|
39
|
+
| Priority | JS | Go | Python | Notes |
|
|
40
|
+
|----------|----|----|--------|-------|
|
|
41
|
+
| 1 | Explicit param | Explicit param | Explicit param | ✅ All match |
|
|
42
|
+
| 2 | - | `FIREBASE_PROJECT_ID` | `FIREBASE_PROJECT_ID` | ⚠️ JS missing |
|
|
43
|
+
| 3 | - | `GOOGLE_CLOUD_PROJECT` | `GOOGLE_CLOUD_PROJECT` | ⚠️ JS missing |
|
|
44
|
+
| 4 | - | `GCLOUD_PROJECT` | `GCLOUD_PROJECT` | ⚠️ JS missing |
|
|
45
|
+
| 5 | ADC | Credentials | Credentials dict | ✅ All match |
|
|
46
|
+
|
|
47
|
+
**Action Required:** JS should add env var resolution to match Go/Python.
|
|
48
|
+
|
|
49
|
+
***
|
|
50
|
+
|
|
51
|
+
## 2. Metrics Comparison
|
|
52
|
+
|
|
53
|
+
### Generate Metrics
|
|
54
|
+
|
|
55
|
+
| Metric | JS | Go | Python | GCP Docs |
|
|
56
|
+
|--------|----|----|--------|----------|
|
|
57
|
+
| `genkit/ai/generate/requests` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
58
|
+
| `genkit/ai/generate/latency` | ✅ Histogram | ✅ Histogram | ✅ Histogram | ✅ |
|
|
59
|
+
| `genkit/ai/generate/input/tokens` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
60
|
+
| `genkit/ai/generate/input/characters` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
61
|
+
| `genkit/ai/generate/input/images` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
62
|
+
| `genkit/ai/generate/input/videos` | ❌ | ✅ Counter | ✅ Counter | ✅ |
|
|
63
|
+
| `genkit/ai/generate/input/audio` | ❌ | ✅ Counter | ✅ Counter | ✅ |
|
|
64
|
+
| `genkit/ai/generate/output/tokens` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
65
|
+
| `genkit/ai/generate/output/characters` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
66
|
+
| `genkit/ai/generate/output/images` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
67
|
+
| `genkit/ai/generate/output/videos` | ❌ | ✅ Counter | ✅ Counter | ✅ |
|
|
68
|
+
| `genkit/ai/generate/output/audio` | ❌ | ✅ Counter | ✅ Counter | ✅ |
|
|
69
|
+
| `genkit/ai/generate/thinking/tokens` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ |
|
|
70
|
+
|
|
71
|
+
**Gap Found:** JS is missing video and audio metrics that Go and Python have.
|
|
72
|
+
|
|
73
|
+
### Feature Metrics
|
|
74
|
+
|
|
75
|
+
| Metric | JS | Go | Python | Status |
|
|
76
|
+
|--------|----|----|--------|--------|
|
|
77
|
+
| `genkit/feature/requests` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ PARITY |
|
|
78
|
+
| `genkit/feature/latency` | ✅ Histogram | ✅ Histogram | ✅ Histogram | ✅ PARITY |
|
|
79
|
+
|
|
80
|
+
### Path Metrics
|
|
81
|
+
|
|
82
|
+
| Metric | JS | Go | Python | Status |
|
|
83
|
+
|--------|----|----|--------|--------|
|
|
84
|
+
| `genkit/feature/path/requests` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ PARITY |
|
|
85
|
+
| `genkit/feature/path/latency` | ✅ Histogram | ✅ Histogram | ✅ Histogram | ✅ PARITY |
|
|
86
|
+
|
|
87
|
+
### Engagement Metrics
|
|
88
|
+
|
|
89
|
+
| Metric | JS | Go | Python | Status |
|
|
90
|
+
|--------|----|----|--------|--------|
|
|
91
|
+
| `genkit/engagement/feedback` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ PARITY |
|
|
92
|
+
| `genkit/engagement/acceptance` | ✅ Counter | ✅ Counter | ✅ Counter | ✅ PARITY |
|
|
93
|
+
|
|
94
|
+
***
|
|
95
|
+
|
|
96
|
+
## 3. Metric Dimensions Comparison
|
|
97
|
+
|
|
98
|
+
### Generate Metric Dimensions
|
|
99
|
+
|
|
100
|
+
| Dimension | JS | Go | Python | Notes |
|
|
101
|
+
|-----------|----|----|--------|-------|
|
|
102
|
+
| `modelName` | ✅ (1024 chars) | ✅ (1024 chars) | ✅ (1024 chars) | ✅ PARITY (fixed) |
|
|
103
|
+
| `featureName` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
104
|
+
| `path` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
105
|
+
| `status` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
106
|
+
| `error` | ✅ (on failure) | ✅ (on failure) | ✅ (on failure) | ✅ PARITY |
|
|
107
|
+
| `source` | `"ts"` | `"go"` | `"py"` | ✅ Correctly different |
|
|
108
|
+
| `sourceVersion` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
109
|
+
|
|
110
|
+
### Feature Metric Dimensions
|
|
111
|
+
|
|
112
|
+
| Dimension | JS | Go | Python | Notes |
|
|
113
|
+
|-----------|----|----|--------|-------|
|
|
114
|
+
| `name` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
115
|
+
| `status` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
116
|
+
| `error` | ✅ (on failure) | ✅ (on failure) | ✅ (on failure) | ✅ PARITY |
|
|
117
|
+
| `source` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
118
|
+
| `sourceVersion` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
119
|
+
|
|
120
|
+
### Path Metric Dimensions
|
|
121
|
+
|
|
122
|
+
| Dimension | JS | Go | Python | Notes |
|
|
123
|
+
|-----------|----|----|--------|-------|
|
|
124
|
+
| `featureName` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
125
|
+
| `status` | ✅ (always "failure") | ✅ | ✅ | ✅ PARITY |
|
|
126
|
+
| `error` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
127
|
+
| `path` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
128
|
+
| `source` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
129
|
+
| `sourceVersion` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
130
|
+
|
|
131
|
+
### Engagement Dimensions
|
|
132
|
+
|
|
133
|
+
| Dimension | JS | Go | Python | Notes |
|
|
134
|
+
|-----------|----|----|--------|-------|
|
|
135
|
+
| `name` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
136
|
+
| `value` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
137
|
+
| `hasText` (feedback) | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
138
|
+
| `source` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
139
|
+
| `sourceVersion` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
140
|
+
|
|
141
|
+
***
|
|
142
|
+
|
|
143
|
+
## 4. Constants and Limits Comparison
|
|
144
|
+
|
|
145
|
+
### Content Limits
|
|
146
|
+
|
|
147
|
+
| Constant | JS | Go | Python | GCP Docs | Notes |
|
|
148
|
+
|----------|----|----|--------|----------|-------|
|
|
149
|
+
| Max log content | 128,000 | 128,000 | 128,000 | N/A | ✅ PARITY |
|
|
150
|
+
| Max path length | 4,096 | 4,096 | 4,096 | N/A | ✅ PARITY |
|
|
151
|
+
| Error name truncation | 1,024 | - | 1,024 | N/A | ✅ PARITY |
|
|
152
|
+
| Error message truncation | 4,096 | - | 4,096 | N/A | ✅ PARITY |
|
|
153
|
+
| Error stack truncation | 32,768 | - | 32,768 | N/A | ✅ PARITY |
|
|
154
|
+
| Metric dimension max | 256 | - | 256 | ✅ (256) | ✅ PARITY |
|
|
155
|
+
| Model name truncation | 1,024 | 1,024 | 256 | N/A | ⚠️ Python shorter |
|
|
156
|
+
|
|
157
|
+
### Timing Constants
|
|
158
|
+
|
|
159
|
+
| Constant | JS | Go | Python | GCP Docs | Notes |
|
|
160
|
+
|----------|----|----|--------|----------|-------|
|
|
161
|
+
| Min metric interval | 5,000ms | 5,000ms | 5,000ms | ✅ 5,000ms | ✅ PARITY |
|
|
162
|
+
| Dev metric interval | 5,000ms | 5,000ms | 5,000ms | N/A | ✅ PARITY |
|
|
163
|
+
| Prod metric interval | - | 300,000ms | 300,000ms | N/A | JS uses custom |
|
|
164
|
+
| Default metric interval | - | - | 60,000ms | N/A | Python specific |
|
|
165
|
+
| Start time adjustment | 1ms | - | 1ms | N/A | ✅ PARITY |
|
|
166
|
+
|
|
167
|
+
***
|
|
168
|
+
|
|
169
|
+
## 5. Span Attributes Comparison
|
|
170
|
+
|
|
171
|
+
### Input Attributes (Read)
|
|
172
|
+
|
|
173
|
+
| Attribute | JS | Go | Python | Notes |
|
|
174
|
+
|-----------|----|----|--------|-------|
|
|
175
|
+
| `genkit:type` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
176
|
+
| `genkit:metadata:subtype` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
177
|
+
| `genkit:isRoot` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
178
|
+
| `genkit:name` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
179
|
+
| `genkit:path` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
180
|
+
| `genkit:input` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
181
|
+
| `genkit:output` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
182
|
+
| `genkit:state` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
183
|
+
| `genkit:isFailureSource` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
184
|
+
| `genkit:sessionId` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
185
|
+
| `genkit:threadName` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
186
|
+
| `genkit:metadata:flow:name` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
187
|
+
| `genkit:metadata:feedbackValue` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
188
|
+
| `genkit:metadata:textFeedback` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
189
|
+
| `genkit:metadata:acceptanceValue` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
190
|
+
|
|
191
|
+
### Output Attributes (Written)
|
|
192
|
+
|
|
193
|
+
| Attribute | JS | Go | Python | Notes |
|
|
194
|
+
|-----------|----|----|--------|-------|
|
|
195
|
+
| `genkit:input` → `<redacted>` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
196
|
+
| `genkit:output` → `<redacted>` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
197
|
+
| `/http/status_code` = "599" | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
198
|
+
| `genkit:failedSpan` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
199
|
+
| `genkit:failedPath` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
200
|
+
| `genkit:feature` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
201
|
+
| `genkit:model` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
202
|
+
| `genkit:rootState` | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
203
|
+
| Label normalization (`:` → `/`) | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
204
|
+
|
|
205
|
+
***
|
|
206
|
+
|
|
207
|
+
## 6. Log Message Format Comparison
|
|
208
|
+
|
|
209
|
+
### Generate Logs
|
|
210
|
+
|
|
211
|
+
| Log Type | JS Format | Go Format | Python Format | Status |
|
|
212
|
+
|----------|-----------|-----------|---------------|--------|
|
|
213
|
+
| Config | `Config[{path}, {model}]` | `[genkit] Config[{path}, {model}]` | `Config[{path}, {model}]` | ⚠️ Go prefix |
|
|
214
|
+
| Input | `Input[{path}, {model}] (part X of Y in message M of N)` | Same | Same | ✅ PARITY |
|
|
215
|
+
| Output | `Output[{path}, {model}] (part X of Y)` | Same | Same | ✅ PARITY |
|
|
216
|
+
|
|
217
|
+
### Feature Logs
|
|
218
|
+
|
|
219
|
+
| Log Type | JS Format | Go Format | Python Format | Status |
|
|
220
|
+
|----------|-----------|-----------|---------------|--------|
|
|
221
|
+
| Input | `Input[{path}, {name}]` | `[genkit] Input[...]` | `Input[{path}, {name}]` | ⚠️ Go prefix |
|
|
222
|
+
| Output | `Output[{path}, {name}]` | `[genkit] Output[...]` | `Output[{path}, {name}]` | ⚠️ Go prefix |
|
|
223
|
+
|
|
224
|
+
### Error Logs
|
|
225
|
+
|
|
226
|
+
| Log Type | JS Format | Go Format | Python Format | Status |
|
|
227
|
+
|----------|-----------|-----------|---------------|--------|
|
|
228
|
+
| Error | `Error[{path}, {error}]` | `[genkit] Error[...]` | `Error[{path}, {error}]` | ⚠️ Go prefix |
|
|
229
|
+
|
|
230
|
+
### Engagement Logs
|
|
231
|
+
|
|
232
|
+
| Log Type | JS Format | Go Format | Python Format | Status |
|
|
233
|
+
|----------|-----------|-----------|---------------|--------|
|
|
234
|
+
| Feedback | `UserFeedback[{name}]` | `[genkit] UserFeedback[...]` | `UserFeedback[{name}]` | ⚠️ Go prefix |
|
|
235
|
+
| Acceptance | `UserAcceptance[{name}]` | `[genkit] UserAcceptance[...]` | `UserAcceptance[{name}]` | ⚠️ Go prefix |
|
|
236
|
+
|
|
237
|
+
**Note:** Go adds `[genkit]` prefix to all logs. This is acceptable variation for log filtering.
|
|
238
|
+
|
|
239
|
+
***
|
|
240
|
+
|
|
241
|
+
## 7. GCP Log Correlation Attributes
|
|
242
|
+
|
|
243
|
+
Per [Cloud Logging documentation](https://cloud.google.com/logging/docs/structured-logging):
|
|
244
|
+
|
|
245
|
+
| Attribute | JS | Go | Python | GCP Docs | Status |
|
|
246
|
+
|-----------|----|----|--------|----------|--------|
|
|
247
|
+
| `logging.googleapis.com/trace` | ✅ | ✅ | ✅ | ✅ Required | ✅ PARITY |
|
|
248
|
+
| `logging.googleapis.com/spanId` | ✅ | ✅ | ✅ | ✅ Required | ✅ PARITY |
|
|
249
|
+
| `logging.googleapis.com/trace_sampled` | ✅ | ✅ | ✅ | ✅ Required | ✅ PARITY |
|
|
250
|
+
|
|
251
|
+
Format: `projects/{PROJECT_ID}/traces/{TRACE_ID}`
|
|
252
|
+
|
|
253
|
+
***
|
|
254
|
+
|
|
255
|
+
## 8. IAM Roles Required
|
|
256
|
+
|
|
257
|
+
Per GCP documentation:
|
|
258
|
+
|
|
259
|
+
| Service | Role | JS | Go | Python | GCP Docs |
|
|
260
|
+
|---------|------|----|----|--------|----------|
|
|
261
|
+
| Cloud Trace | `roles/cloudtrace.agent` | ✅ | ✅ | ✅ | ✅ |
|
|
262
|
+
| Cloud Monitoring | `roles/monitoring.metricWriter` | ✅ | ✅ | ✅ | ✅ |
|
|
263
|
+
| Cloud Monitoring | `roles/telemetry.metricsWriter` | - | - | ✅ | ✅ |
|
|
264
|
+
| Cloud Logging | `roles/logging.logWriter` | ✅ | - | - | ✅ |
|
|
265
|
+
|
|
266
|
+
***
|
|
267
|
+
|
|
268
|
+
## 9. Telemetry Dispatch Logic Comparison
|
|
269
|
+
|
|
270
|
+
| Condition | JS | Go | Python | Status |
|
|
271
|
+
|-----------|----|----|--------|--------|
|
|
272
|
+
| All genkit spans → paths.tick() | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
273
|
+
| isRoot → features.tick() | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
274
|
+
| isRoot → set rootState | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
275
|
+
| action + model (non-root) → generate.tick() | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
276
|
+
| action/flow/flowStep/util (non-root) → action.tick() | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
277
|
+
| userEngagement → engagement.tick() | ✅ | ✅ | ✅ | ✅ PARITY |
|
|
278
|
+
|
|
279
|
+
***
|
|
280
|
+
|
|
281
|
+
## 10. Issues Found and Recommendations
|
|
282
|
+
|
|
283
|
+
### High Priority
|
|
284
|
+
|
|
285
|
+
1. **~~Python: Model name truncation too short~~** ✅ FIXED
|
|
286
|
+
* \~~Current: 256 chars~~
|
|
287
|
+
* \~~Should be: 1024 chars (matching JS/Go)~~
|
|
288
|
+
* \~~File: `generate.py`~~
|
|
289
|
+
* **Status:** Fixed - now uses 1024 chars for modelName dimension
|
|
290
|
+
|
|
291
|
+
### Medium Priority
|
|
292
|
+
|
|
293
|
+
2. **JS: Missing video/audio metrics**
|
|
294
|
+
* Missing: `input/videos`, `input/audio`, `output/videos`, `output/audio`
|
|
295
|
+
* Go and Python have these metrics
|
|
296
|
+
|
|
297
|
+
3. **JS: Missing env var project ID resolution**
|
|
298
|
+
* Should add: `FIREBASE_PROJECT_ID`, `GOOGLE_CLOUD_PROJECT`, `GCLOUD_PROJECT`
|
|
299
|
+
|
|
300
|
+
### Low Priority (Acceptable Variations)
|
|
301
|
+
|
|
302
|
+
4. **Go: Log message prefix**
|
|
303
|
+
* Go adds `[genkit]` prefix to all logs
|
|
304
|
+
* Acceptable for filtering purposes
|
|
305
|
+
|
|
306
|
+
5. **Python: Positive flag for I/O logging**
|
|
307
|
+
* Python: `log_input_and_output=True` enables logging
|
|
308
|
+
* JS/Go: `disableLoggingInputAndOutput=False` enables logging
|
|
309
|
+
* Both achieve same result, Python's is more intuitive
|
|
310
|
+
|
|
311
|
+
***
|
|
312
|
+
|
|
313
|
+
## 11. GCP Documentation References
|
|
314
|
+
|
|
315
|
+
* Cloud Trace Overview: https://cloud.google.com/trace/docs
|
|
316
|
+
* Cloud Trace IAM: https://cloud.google.com/trace/docs/iam
|
|
317
|
+
* Cloud Monitoring Overview: https://cloud.google.com/monitoring/docs
|
|
318
|
+
* Cloud Monitoring Quotas: https://cloud.google.com/monitoring/quotas
|
|
319
|
+
* Cloud Logging Structured: https://cloud.google.com/logging/docs/structured-logging
|
|
320
|
+
* Log-Trace Correlation: https://cloud.google.com/trace/docs/trace-log-integration
|
|
321
|
+
* Metric Naming: https://cloud.google.com/monitoring/api/v3/naming-conventions
|
|
322
|
+
* Custom Metrics: https://cloud.google.com/monitoring/custom-metrics
|
|
323
|
+
* OpenTelemetry GCP: https://google-cloud-opentelemetry.readthedocs.io/
|
|
324
|
+
|
|
325
|
+
***
|
|
326
|
+
|
|
327
|
+
## 12. Verification Checklist
|
|
328
|
+
|
|
329
|
+
* \[x] All metric names match across implementations
|
|
330
|
+
* \[x] All metric types (Counter/Histogram) match
|
|
331
|
+
* \[x] Span attributes read/written match
|
|
332
|
+
* \[x] Log correlation attributes follow GCP spec
|
|
333
|
+
* \[x] Minimum metric interval enforced (5000ms)
|
|
334
|
+
* \[x] PII redaction implemented
|
|
335
|
+
* \[x] Error span marking (`/http/status_code: 599`)
|
|
336
|
+
* \[x] Label normalization (`:` → `/`)
|
|
337
|
+
* \[x] Start time adjustment for DELTA→CUMULATIVE
|
|
338
|
+
* \[x] Model name truncation (Python fixed to 1024 chars)
|
|
339
|
+
* \[ ] Video/audio metrics (JS needs addition - tracked separately)
|
|
340
|
+
|
|
341
|
+
***
|
|
342
|
+
|
|
343
|
+
*Last updated: 2026-01-28*
|
|
344
|
+
*Analyzed versions: JS (latest), Go (latest), Python (latest)*
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: genkit-google-cloud
|
|
3
|
+
Version: 0.9.0
|
|
4
|
+
Summary: Genkit Google Cloud Plugin
|
|
5
|
+
Project-URL: Bug Tracker, https://github.com/genkit-ai/genkit/issues
|
|
6
|
+
Project-URL: Documentation, https://firebase.google.com/docs/genkit
|
|
7
|
+
Project-URL: Homepage, https://github.com/genkit-ai/genkit
|
|
8
|
+
Project-URL: Repository, https://github.com/genkit-ai/genkit/tree/main/py
|
|
9
|
+
Author: Google
|
|
10
|
+
Author-email: Yesudeep Mangalapilly <yesudeep@google.com>, Elisa Shen <mengqin@google.com>, Niraj Nepal <nnepal@google.com>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
Keywords: ai,artificial-intelligence,cloud-trace,gcp,generative-ai,genkit,google-cloud,llm,machine-learning,telemetry
|
|
14
|
+
Classifier: Development Status :: 3 - Alpha
|
|
15
|
+
Classifier: Environment :: Console
|
|
16
|
+
Classifier: Environment :: Web Environment
|
|
17
|
+
Classifier: Framework :: AsyncIO
|
|
18
|
+
Classifier: Framework :: Pydantic
|
|
19
|
+
Classifier: Framework :: Pydantic :: 2
|
|
20
|
+
Classifier: Intended Audience :: Developers
|
|
21
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
22
|
+
Classifier: Operating System :: OS Independent
|
|
23
|
+
Classifier: Programming Language :: Python
|
|
24
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
25
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
26
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
27
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
28
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
29
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
30
|
+
Classifier: Topic :: Scientific/Engineering :: Artificial Intelligence
|
|
31
|
+
Classifier: Topic :: Software Development :: Libraries
|
|
32
|
+
Classifier: Typing :: Typed
|
|
33
|
+
Requires-Python: >=3.10
|
|
34
|
+
Requires-Dist: genkit
|
|
35
|
+
Requires-Dist: google-cloud-logging>=3.10.0
|
|
36
|
+
Requires-Dist: opentelemetry-exporter-gcp-monitoring>=1.9.0
|
|
37
|
+
Requires-Dist: opentelemetry-exporter-gcp-trace>=1.9.0
|
|
38
|
+
Requires-Dist: strenum>=0.4.15; python_version < '3.11'
|
|
39
|
+
Description-Content-Type: text/markdown
|
|
40
|
+
|
|
41
|
+
# Genkit Google Cloud Plugin
|
|
42
|
+
|
|
43
|
+
Export Genkit telemetry to Google Cloud Trace, Cloud Monitoring, and Cloud Logging.
|
|
44
|
+
|
|
45
|
+
## Installation
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
uv add genkit-google-cloud genkit-google-genai
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Usage
|
|
52
|
+
|
|
53
|
+
```python
|
|
54
|
+
from genkit import Genkit
|
|
55
|
+
from genkit_google_cloud import enable_google_cloud_telemetry
|
|
56
|
+
from genkit_google_genai import GoogleAI
|
|
57
|
+
|
|
58
|
+
enable_google_cloud_telemetry(project_id='my-project')
|
|
59
|
+
|
|
60
|
+
ai = Genkit(plugins=[GoogleAI()], model='googleai/gemini-flash-latest')
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Requires Google Cloud Application Default Credentials (ADC) or explicit credentials.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# Genkit Google Cloud Plugin
|
|
2
|
+
|
|
3
|
+
Export Genkit telemetry to Google Cloud Trace, Cloud Monitoring, and Cloud Logging.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
uv add genkit-google-cloud genkit-google-genai
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
```python
|
|
14
|
+
from genkit import Genkit
|
|
15
|
+
from genkit_google_cloud import enable_google_cloud_telemetry
|
|
16
|
+
from genkit_google_genai import GoogleAI
|
|
17
|
+
|
|
18
|
+
enable_google_cloud_telemetry(project_id='my-project')
|
|
19
|
+
|
|
20
|
+
ai = Genkit(plugins=[GoogleAI()], model='googleai/gemini-flash-latest')
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Requires Google Cloud Application Default Credentials (ADC) or explicit credentials.
|