Skip to content

Commit f4e0c29

Browse files
invictus2010yqlu
andauthored
feat(dashboards): Update Gemini Code Assist dashboard to use PROJECT_ID template variable (#1218)
Co-authored-by: YQ Lu <yql@google.com>
1 parent 8af3aa3 commit f4e0c29

2 files changed

Lines changed: 16 additions & 9 deletions

File tree

dashboards/google-gemini-code-assist/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,9 @@ This dashboard has charts for Gemini Code Assist using [Gemini for Google Cloud
1313
- Click on 'Create Custom Dashboard'.
1414
- On the top right, click on the 'Settings' icon.
1515
- Under 'JSON' -> 'JSON Editor'
16-
- Copy the content of [this](https://github.com/GoogleCloudPlatform/monitoring-dashboard-samples/blob/master/dashboards/google-gemini-code-assist/gemini-code-assist-overview-from-metadata-logs.json) file, replacing Project_ID with your own Project_ID.
17-
- Click on Apply changes.
16+
- Copy the content of [this](https://github.com/GoogleCloudPlatform/monitoring-dashboard-samples/blob/master/dashboards/google-gemini-code-assist/gemini-code-assist-overview-from-metadata-logs.json) file and paste it into the JSON Editor.
17+
- Click on 'Apply changes'.
18+
- At the top of the dashboard, use the **PROJECT_ID** filter to select your project.
1819

1920
### Considerations:
2021
- The dashboard contains daily metrics that must be viewed with a time window greater than one day.

dashboards/google-gemini-code-assist/gemini-code-assist-overview-from-metadata-logs.json

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
{
22
"displayName": "Gemini Code Assist Overview from Metadata Logs",
3-
"dashboardFilters": [],
3+
"dashboardFilters": [
4+
{
5+
"filterType": "RESOURCE_LABEL",
6+
"labelKey": "project_id",
7+
"templateVariable": "PROJECT_ID"
8+
}
9+
],
410
"labels": {},
511
"mosaicLayout": {
612
"columns": 48,
@@ -49,7 +55,7 @@
4955
},
5056
"queryHandle": "",
5157
"savedQueryId": "",
52-
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(labels, '$.user_id')) as DAU, CAST(timestamp AS DATE) AS event_date\nFROM\n `PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(labels, '$.user_id') is not NULL\n AND (\n JSON_VALUE(json_payload, '$.chatExposure.originalRequestId') is not NULL\n OR JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL\n OR JSON_VALUE(json_payload, '$.codeExposure.originalRequestId') is not NULL\n )\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\nevent_date\nORDER BY\nevent_date\n"
58+
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(labels, '$.user_id')) as DAU, CAST(timestamp AS DATE) AS event_date\nFROM\n `@PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(labels, '$.user_id') is not NULL\n AND (\n JSON_VALUE(json_payload, '$.chatExposure.originalRequestId') is not NULL\n OR JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL\n OR JSON_VALUE(json_payload, '$.codeExposure.originalRequestId') is not NULL\n )\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\nevent_date\nORDER BY\nevent_date\n"
5359
},
5460
"outputFullDuration": false,
5561
"unitOverride": ""
@@ -109,7 +115,7 @@
109115
},
110116
"queryHandle": "",
111117
"savedQueryId": "",
112-
"sql": "SELECT\nexposures_date,\nacceptances_count / exposures_count as acceptance_rate\nFROM\n(\nSELECT\nCOUNT (DISTINCT JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId')) as acceptances_count, CAST(timestamp AS DATE) AS acceptances_date\nFROM\n`PROJECT_ID.global._Default._Default`\nWHERE\nJSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL \nAND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\nacceptances_date\n) as acceptances\nJOIN\n(\nSELECT\nCOUNT (DISTINCT JSON_VALUE(json_payload, '$.codeExposure.originalRequestId')) as exposures_count, CAST(timestamp AS DATE) AS exposures_date\nFROM\n`PROJECT_ID.global._Default._Default`\nWHERE\nJSON_VALUE(json_payload, '$.codeExposure.originalRequestId') is not NULL\nAND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\nexposures_date\n) as exposures\nON\nexposures.exposures_date = acceptances.acceptances_date\nORDER BY\nexposures_date ASC"
118+
"sql": "SELECT\nexposures_date,\nacceptances_count / exposures_count as acceptance_rate\nFROM\n(\nSELECT\nCOUNT (DISTINCT JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId')) as acceptances_count, CAST(timestamp AS DATE) AS acceptances_date\nFROM\n`@PROJECT_ID.global._Default._Default`\nWHERE\nJSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL \nAND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\nacceptances_date\n) as acceptances\nJOIN\n(\nSELECT\nCOUNT (DISTINCT JSON_VALUE(json_payload, '$.codeExposure.originalRequestId')) as exposures_count, CAST(timestamp AS DATE) AS exposures_date\nFROM\n`@PROJECT_ID.global._Default._Default`\nWHERE\nJSON_VALUE(json_payload, '$.codeExposure.originalRequestId') is not NULL\nAND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\nexposures_date\n) as exposures\nON\nexposures.exposures_date = acceptances.acceptances_date\nORDER BY\nexposures_date ASC"
113119
},
114120
"outputFullDuration": false,
115121
"unitOverride": ""
@@ -169,7 +175,7 @@
169175
},
170176
"queryHandle": "",
171177
"savedQueryId": "",
172-
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(json_payload, '$.codeExposure.originalRequestId')) as exposures_count, CAST(timestamp AS DATE) AS exposures_date\nFROM\n `PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(json_payload, '$.codeExposure.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\n exposures_date\nORDER BY\n exposures_date\n"
178+
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(json_payload, '$.codeExposure.originalRequestId')) as exposures_count, CAST(timestamp AS DATE) AS exposures_date\nFROM\n `@PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(json_payload, '$.codeExposure.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\n exposures_date\nORDER BY\n exposures_date\n"
173179
},
174180
"outputFullDuration": false,
175181
"unitOverride": ""
@@ -230,7 +236,7 @@
230236
},
231237
"queryHandle": "",
232238
"savedQueryId": "",
233-
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId')) as acceptances_count, CAST(timestamp AS DATE) AS acceptances_date\nFROM\n `PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\n acceptances_date\nORDER BY\n acceptances_date\n"
239+
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId')) as acceptances_count, CAST(timestamp AS DATE) AS acceptances_date\nFROM\n `@PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\n acceptances_date\nORDER BY\n acceptances_date\n"
234240
},
235241
"outputFullDuration": false,
236242
"unitOverride": ""
@@ -290,7 +296,7 @@
290296
},
291297
"queryHandle": "",
292298
"savedQueryId": "",
293-
"sql": "SELECT\n SUM(lines) as lines_count,\n CAST(max_timestamp AS DATE) AS line_count_day\nFROM\n(\n SELECT\n JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') as request_id,\n MAX(CAST(JSON_VALUE(json_payload, '$.codeAcceptance.linesCount') AS INT)) as lines,\n MAX(timestamp) as max_timestamp\n FROM\n `PROJECT_ID.global._Default._Default`\n WHERE\n JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\n GROUP BY\n request_id\n )\nGROUP BY\n line_count_day\nORDER BY\n line_count_day"
299+
"sql": "SELECT\n SUM(lines) as lines_count,\n CAST(max_timestamp AS DATE) AS line_count_day\nFROM\n(\n SELECT\n JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') as request_id,\n MAX(CAST(JSON_VALUE(json_payload, '$.codeAcceptance.linesCount') AS INT)) as lines,\n MAX(timestamp) as max_timestamp\n FROM\n `@PROJECT_ID.global._Default._Default`\n WHERE\n JSON_VALUE(json_payload, '$.codeAcceptance.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\n GROUP BY\n request_id\n )\nGROUP BY\n line_count_day\nORDER BY\n line_count_day"
294300
},
295301
"outputFullDuration": false,
296302
"unitOverride": ""
@@ -351,7 +357,7 @@
351357
},
352358
"queryHandle": "",
353359
"savedQueryId": "",
354-
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(json_payload, '$.chatExposure.originalRequestId')) as chat_exposures_count, CAST(timestamp AS DATE) AS chat_exposures_date\nFROM\n `PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(json_payload, '$.chatExposure.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\n chat_exposures_date\nORDER BY\n chat_exposures_date"
360+
"sql": "SELECT\n COUNT (DISTINCT JSON_VALUE(json_payload, '$.chatExposure.originalRequestId')) as chat_exposures_count, CAST(timestamp AS DATE) AS chat_exposures_date\nFROM\n `@PROJECT_ID.global._Default._Default`\nWHERE\n JSON_VALUE(json_payload, '$.chatExposure.originalRequestId') is not NULL\n AND resource.type = \"cloudaicompanion.googleapis.com/Instance\"\nGROUP BY\n chat_exposures_date\nORDER BY\n chat_exposures_date"
355361
},
356362
"outputFullDuration": false,
357363
"unitOverride": ""

0 commit comments

Comments
 (0)