You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2022/09/07 15:53:29 UTC

[GitHub] [beam] aromanenko-dev commented on a diff in pull request #22545: [TPC-DS] Store metrics into BigQuery and InfluxDB

aromanenko-dev commented on code in PR #22545:
URL: https://github.com/apache/beam/pull/22545#discussion_r965020177


##########
sdks/java/testing/tpcds/src/main/java/org/apache/beam/sdk/tpcds/SqlTransformRunner.java:
##########
@@ -306,6 +327,68 @@ public static void runUsingSqlTransform(String[] args) throws Exception {
 
     executor.shutdown();
 
-    printExecutionSummary(completion, queryNames.length);
+    List<TpcdsRunResult> results = collectTpcdsResults(completion, queryNames.length);
+
+    if (tpcdsOptions.getExportSummaryToInfluxDB()) {
+      final long timestamp = start.getMillis() / 1000; // seconds
+      savePerfsToInfluxDB(tpcdsOptions, results, timestamp);
+    }
+
+    printExecutionSummary(results);
+  }
+
+  private static void savePerfsToInfluxDB(
+      final TpcdsOptions options, final List<TpcdsRunResult> results, final long timestamp) {
+    final InfluxDBSettings settings = getInfluxSettings(options);
+    final Map<String, String> tags = options.getInfluxTags();
+    final String runner = options.getRunner().getSimpleName();
+    final List<Map<String, Object>> schemaResults =
+        results.stream()
+            .map(
+                entry ->
+                    getResultsFromSchema(
+                        entry, timestamp, runner, produceMeasurement(options, entry)))
+            .collect(toList());
+    InfluxDBPublisher.publishTpcdsResults(schemaResults, settings, tags);
+  }
+
+  private static String produceMeasurement(final TpcdsOptions options, TpcdsRunResult entry) {
+    return String.format(
+        "%s_%s_%s_%s",
+        options.getBaseInfluxMeasurement(),
+        entry.getQueryName(),
+        entry.getDialect(),
+        entry.getDataSize());

Review Comment:
   Well, it's just a config option, so I made it a part of measurement to distinguish for different dashboards.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org