henrikingo commented on code in PR #146:
URL: https://github.com/apache/otava/pull/146#discussion_r3033983532


##########
docs/JSON.md:
##########
@@ -0,0 +1,136 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one
+ or more contributor license agreements.  See the NOTICE file
+ distributed with this work for additional information
+ regarding copyright ownership.  The ASF licenses this file
+ to you under the Apache License, Version 2.0 (the
+ "License"); you may not use this file except in compliance
+ with the License.  You may obtain a copy of the License at
+
+   http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing,
+ software distributed under the License is distributed on an
+ "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ KIND, either express or implied.  See the License for the
+ specific language governing permissions and limitations
+ under the License.
+-->
+# JSON Data Source
+
+> **Tip**
+> See [examples/](../examples/) for sample configuration files.
+
+## Overview
+
+`JsonImporter` reads benchmark results from a local JSON file and feeds them 
into Otava for change-point analysis. It is a simple data source to set up — no 
external database or service is required.
+
+The importer caches parsed file content in memory, so a file is only read once 
per session even if multiple tests reference the same path.
+
+---
+
+## Expected JSON Format
+
+The input file must be a JSON array. Each element represents a single 
benchmark run.
+```json
+[
+  {
+    "timestamp": 1711929600,
+    "metrics": [
+      { "name": "throughput", "value": 4821.0 },
+      { "name": "p99_latency_ms", "value": 142.7 }
+    ],
+    "attributes": {
+      "branch": "main",
+      "commit": "a3f9c12"
+    }
+  },
+  {
+    "timestamp": 1712016000,
+    "metrics": [
+      { "name": "throughput", "value": 5013.0 },
+      { "name": "p99_latency_ms", "value": 138.2 }
+    ],
+    "attributes": {
+      "branch": "main",
+      "commit": "b7d2e45"
+    }
+  }
+]
+```
+
+---
+
+## Fields
+
+### `timestamp`
+
+- **Type:** integer (Unix epoch seconds)
+- **Required:** yes
+- Identifies when the benchmark run occurred. Used for time-range filtering 
via `DataSelector`.

Review Comment:
   Sorry I missed this the first time. Actually, this should be the time  that 
the commit was merged to the branch we are tracking. Typically this is recorded 
in git's history as a merge-commit.
   
   In most cases this should NOT be the time that the benchmark was run. In 
particular, it often happens that you want to rerun a benchmark with the system 
under test ghecked out and built from this same githash. In such a case, the 
new results should be recorded with this same timestamp. For the same githash, 
the timestamp should be constant, regardless of when or how many times the 
benchmark was run.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to