88
99import { Spanner } from '@google-cloud/spanner' ;
1010
11+ /**
12+ * The workflow performance results are stored in a spanner database within our
13+ * project to be able to retrieve later, The commit sha will be used as a foreign
14+ * key to point to specific commits found in the table of commit shas expressing
15+ * the full graph of commits within the git graph for the repository.
16+ *
17+ * The workflow performance table is defined with the following characteristics.
18+ *
19+ * |--------------------------------------------------------------------|
20+ * | Column | Type | Notes |
21+ * |--------------------------------------------------------------------|
22+ * | workflow_performance_id | STRING(36) | Autogenerated |
23+ * | commit_sha | STRING(40) | |
24+ * | value | FLOAT64 | |
25+ * | name | STRING(256) | |
26+ * |--------------------------------------------------------------------|
27+ */
28+
29+ /** The reuslt of workflow performance eresult to be stored in the database. */
1130export interface WorkflowPerformanceRowResult {
1231 commit_sha : string ;
1332 value : number ;
1433 name : string ;
1534}
1635
36+ /** Add a single workflow performance result to the spanner database. */
1737export async function addWorkflowPerformanceResult ( result : WorkflowPerformanceRowResult ) {
1838 /** The spanner client instance. */
1939 const spanner = new Spanner ( {
@@ -27,7 +47,7 @@ export async function addWorkflowPerformanceResult(result: WorkflowPerformanceRo
2747 const workflowPerformanceTable = database . table ( 'WorkflowPerformance' ) ;
2848
2949 try {
30- await workflowPerformanceTable . insert ( [ result ] ) ;
50+ await workflowPerformanceTable . insert ( result ) ;
3151 } finally {
3252 await database . close ( ) ;
3353 }
0 commit comments