{
 "$schema": "https://json-schema.org/draft/2020-12/schema",
 "$id": "https://totktonada.online/tarantool/perf/subtest.schema.json",
 "title": "Tarantool performance: a subtest",
 "description": "The data of a subtest's page, https://totktonada.online/tarantool/perf/<benchmark>/<subtest>: one subtest on every branch, run by run. The pages are a first version: until they settle, a field may still change incompatibly, the schema with it in the same build. Every build matches its schema.",
 "type": "object",
 "required": [
  "$schema",
  "page",
  "generated",
  "newest",
  "lines",
  "prs",
  "series",
  "bench",
  "subtest"
 ],
 "additionalProperties": false,
 "properties": {
  "$schema": {
   "type": "string",
   "format": "uri",
   "description": "This schema."
  },
  "page": {
   "type": "string",
   "format": "uri",
   "description": "The page this is the data of."
  },
  "generated": {
   "$ref": "#/$defs/time",
   "description": "When the page was built."
  },
  "newest": {
   "anyOf": [
    {
     "$ref": "#/$defs/time"
    },
    {
     "type": "null"
    }
   ],
   "description": "When the newest run of the 21 days wrote its points; null if none did."
  },
  "lines": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "branch",
     "runs",
     "changes",
     "earlier",
     "levels",
     "latest",
     "noise",
     "analysis"
    ],
    "additionalProperties": false,
    "properties": {
     "branch": {
      "type": "string",
      "description": "master or release/X.Y."
     },
     "runs": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "run",
        "attempt",
        "kind",
        "tag",
        "sha",
        "at",
        "url",
        "value",
        "subject",
        "apart"
       ],
       "additionalProperties": false,
       "properties": {
        "run": {
         "type": "integer",
         "minimum": 0,
         "description": "The run of perf_micro: its id on GitHub."
        },
        "attempt": {
         "type": "integer",
         "minimum": 1,
         "description": "The attempt of the run."
        },
        "kind": {
         "enum": [
          "push",
          "nightly",
          "manual",
          "tag",
          "pull request"
         ],
         "description": "What started a run: a push to its branch, the nightly schedule (master only), a run by hand, a tag, a pull request labeled performance."
        },
        "tag": {
         "anyOf": [
          {
           "type": "string"
          },
          {
           "type": "null"
          }
         ],
         "description": "The tag of a tag's run; null otherwise."
        },
        "sha": {
         "$ref": "#/$defs/sha",
         "description": "The commit it measured."
        },
        "at": {
         "$ref": "#/$defs/time",
         "description": "When it wrote its points: its own row's time in Otava's tables, or else when its aggregate step started."
        },
        "url": {
         "type": "string",
         "format": "uri",
         "description": "Its job on GitHub."
        },
        "value": {
         "anyOf": [
          {
           "type": "number",
           "description": ""
          },
          {
           "type": "null"
          }
         ],
         "description": "Items per second; null if the run has none."
        },
        "subject": {
         "anyOf": [
          {
           "type": "string"
          },
          {
           "type": "null"
          }
         ],
         "description": "Its subject; null if the clone does not have the commit."
        },
        "apart": {
         "anyOf": [
          {
           "type": "number",
           "description": ""
          },
          {
           "type": "null"
          }
         ],
         "description": "How far the run stands apart from the runs around it, a fraction, when it is noisy: more than the index's noisy.threshold off both the runs before it and the runs after it; null otherwise."
        }
       },
       "description": "A run, its value and its commit's subject."
      },
      "description": "The runs of the 21 days, in the order of the branch's page."
     },
     "changes": {
      "type": "array",
      "items": {
       "$ref": "#/$defs/change"
      },
      "description": "Otava's change points, the oldest first."
     },
     "earlier": {
      "type": "array",
      "items": {
       "$ref": "#/$defs/earlier"
      },
      "description": "The change points only earlier analyses reported, the oldest first."
     },
     "levels": {
      "type": "array",
      "items": {
       "type": "object",
       "required": [
        "first",
        "last",
        "median"
       ],
       "additionalProperties": false,
       "properties": {
        "first": {
         "type": "integer",
         "minimum": 0,
         "description": "The first run of the level: its index in the runs."
        },
        "last": {
         "type": "integer",
         "minimum": 0,
         "description": "Its last run, likewise."
        },
        "median": {
         "type": "number",
         "description": "The median of their values, items per second."
        }
       }
      },
      "description": "The levels between the change points."
     },
     "latest": {
      "anyOf": [
       {
        "type": "number",
        "description": ""
       },
       {
        "type": "null"
       }
      ],
      "description": "The newest value, items per second."
     },
     "noise": {
      "anyOf": [
       {
        "type": "number",
        "description": "A fraction: 0.01 is 1%."
       },
       {
        "type": "null"
       }
      ],
      "description": "The median step between consecutive runs of the subtest, a fraction of the value before it; null with fewer than two runs."
     },
     "analysis": {
      "anyOf": [
       {
        "$ref": "#/$defs/run"
       },
       {
        "type": "null"
       }
      ],
      "description": "The run whose Otava the change points are from; null if none ran it."
     }
    }
   },
   "description": "The branches that have it."
  },
  "prs": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "pr",
     "value",
     "baseline"
    ],
    "additionalProperties": false,
    "properties": {
     "pr": {
      "type": "integer",
      "minimum": 0,
      "description": "The pull request."
     },
     "value": {
      "type": "number",
      "description": "The median of its newest head's runs, items per second."
     },
     "baseline": {
      "anyOf": [
       {
        "type": "number",
        "description": ""
       },
       {
        "type": "null"
       }
      ],
      "description": "The median of master's runs of the commit it is compared with; null if master has no such run."
     }
    }
   },
   "description": "The pull requests labeled performance that ran it."
  },
  "series": {
   "type": "string",
   "description": "The subtest's name in InfluxDB and Otava: <bench>_<subtest>, with /, <, > and : written _."
  },
  "bench": {
   "type": "string",
   "description": "The benchmark: perf/<bench>.cc or perf/lua/<bench>.lua."
  },
  "subtest": {
   "type": "string",
   "description": "The subtest, as the benchmark names it."
  }
 },
 "$defs": {
  "time": {
   "type": "string",
   "format": "date-time",
   "description": "ISO 8601, in UTC+3."
  },
  "sha": {
   "type": "string",
   "pattern": "^[0-9a-f]{12}$",
   "description": "A commit of tarantool/tarantool: the first 12 digits of its hash."
  },
  "run": {
   "type": "object",
   "required": [
    "run",
    "attempt",
    "kind",
    "tag",
    "sha",
    "at",
    "url"
   ],
   "additionalProperties": false,
   "properties": {
    "run": {
     "type": "integer",
     "minimum": 0,
     "description": "The run of perf_micro: its id on GitHub."
    },
    "attempt": {
     "type": "integer",
     "minimum": 1,
     "description": "The attempt of the run."
    },
    "kind": {
     "enum": [
      "push",
      "nightly",
      "manual",
      "tag",
      "pull request"
     ],
     "description": "What started a run: a push to its branch, the nightly schedule (master only), a run by hand, a tag, a pull request labeled performance."
    },
    "tag": {
     "anyOf": [
      {
       "type": "string"
      },
      {
       "type": "null"
      }
     ],
     "description": "The tag of a tag's run; null otherwise."
    },
    "sha": {
     "$ref": "#/$defs/sha",
     "description": "The commit it measured."
    },
    "at": {
     "$ref": "#/$defs/time",
     "description": "When it wrote its points: its own row's time in Otava's tables, or else when its aggregate step started."
    },
    "url": {
     "type": "string",
     "format": "uri",
     "description": "Its job on GitHub."
    }
   },
   "description": "A run of perf_micro on the performance runner."
  },
  "commit": {
   "type": "object",
   "required": [
    "sha",
    "subject",
    "author",
    "date"
   ],
   "additionalProperties": false,
   "properties": {
    "sha": {
     "$ref": "#/$defs/sha"
    },
    "subject": {
     "anyOf": [
      {
       "type": "string"
      },
      {
       "type": "null"
      }
     ],
     "description": "Its subject; null if the clone does not have the commit."
    },
    "author": {
     "anyOf": [
      {
       "type": "string"
      },
      {
       "type": "null"
      }
     ],
     "description": "Its author's name; null likewise."
    },
    "date": {
     "anyOf": [
      {
       "type": "string",
       "format": "date-time"
      },
      {
       "type": "null"
      }
     ],
     "description": "Its commit date, in the time zone git has it in; null likewise."
    }
   },
   "description": "A commit of tarantool/tarantool."
  },
  "change": {
   "type": "object",
   "required": [
    "before",
    "after",
    "pct",
    "seen",
    "possible",
    "drops",
    "shifted",
    "same_commit",
    "commits",
    "code",
    "workflow",
    "compare"
   ],
   "additionalProperties": false,
   "properties": {
    "before": {
     "type": "integer",
     "minimum": 0,
     "description": "The last run before the change: its index in the runs."
    },
    "after": {
     "type": "integer",
     "minimum": 0,
     "description": "The first run after it, likewise."
    },
    "pct": {
     "type": "number",
     "description": "Otava's size of the change, in percent of the level before it: positive is faster."
    },
    "seen": {
     "type": "integer",
     "minimum": 0,
     "description": "How many analyses since saw the same change at the same place, the newest included: a change that comes and goes is seen by few."
    },
    "possible": {
     "type": "integer",
     "minimum": 0,
     "description": "How many analyses ran since: the branch's runs after the change that ran Otava."
    },
    "drops": {
     "type": "integer",
     "minimum": 0,
     "description": "How many times one of those analyses left it out after the one before had reported it: 0 for a change point that stayed once reported."
    },
    "shifted": {
     "type": "boolean",
     "description": "Whether Otava read this subtest's columns shifted: a comma in its name splits the quoted name in the CSV Otava reads, so it took CPU time for items per second."
    },
    "same_commit": {
     "type": "boolean",
     "description": "Whether the runs before and after it measured one commit, so that no code changed between them."
    },
    "commits": {
     "type": "integer",
     "minimum": 0,
     "description": "The commits between the two runs along the first parents, the later run's included; 0 for one commit."
    },
    "code": {
     "type": "boolean",
     "description": "Whether those commits change the code the benchmarks build from: src, third_party, perf, cmake, patches, CMakeLists.txt."
    },
    "workflow": {
     "type": "boolean",
     "description": "Whether they change the workflow that runs the benchmarks."
    },
    "compare": {
     "anyOf": [
      {
       "type": "string",
       "format": "uri",
       "description": ""
      },
      {
       "type": "null"
      }
     ],
     "description": "The commits on GitHub, a compare of the two; null for one commit."
    }
   },
   "description": "A change point of Otava's newest analysis of the branch, between two runs."
  },
  "earlier": {
   "type": "object",
   "required": [
    "before",
    "after",
    "pct",
    "seen",
    "possible",
    "drops",
    "shifted",
    "same_commit",
    "commits",
    "code",
    "workflow",
    "compare",
    "first",
    "last"
   ],
   "additionalProperties": false,
   "properties": {
    "before": {
     "type": "integer",
     "minimum": 0,
     "description": "The last run before the change: its index in the runs."
    },
    "after": {
     "type": "integer",
     "minimum": 0,
     "description": "The first run after it, likewise."
    },
    "pct": {
     "type": "number",
     "description": "Otava's size of the change, in percent of the level before it, as the last analysis that reported it had it: positive is faster."
    },
    "seen": {
     "type": "integer",
     "minimum": 0,
     "description": "How many analyses since reported it; the newest is not one of them."
    },
    "possible": {
     "type": "integer",
     "minimum": 0,
     "description": "How many analyses ran since: the branch's runs after the change that ran Otava."
    },
    "drops": {
     "type": "integer",
     "minimum": 0,
     "description": "How many times one of those analyses left it out after the one before had reported it: 0 for a change point that stayed once reported."
    },
    "shifted": {
     "type": "boolean",
     "description": "Whether the last analysis that reported it read this subtest's columns shifted (a comma in the name)."
    },
    "same_commit": {
     "type": "boolean",
     "description": "Whether the runs before and after it measured one commit, so that no code changed between them."
    },
    "commits": {
     "type": "integer",
     "minimum": 0,
     "description": "The commits between the two runs along the first parents, the later run's included; 0 for one commit."
    },
    "code": {
     "type": "boolean",
     "description": "Whether those commits change the code the benchmarks build from: src, third_party, perf, cmake, patches, CMakeLists.txt."
    },
    "workflow": {
     "type": "boolean",
     "description": "Whether they change the workflow that runs the benchmarks."
    },
    "compare": {
     "anyOf": [
      {
       "type": "string",
       "format": "uri",
       "description": ""
      },
      {
       "type": "null"
      }
     ],
     "description": "The commits on GitHub, a compare of the two; null for one commit."
    },
    "first": {
     "type": "integer",
     "minimum": 0,
     "description": "The run whose analysis reported it first: its index in the runs."
    },
    "last": {
     "type": "integer",
     "minimum": 0,
     "description": "The run whose analysis reported it last, likewise."
    }
   },
   "description": "A change point that earlier analyses of the branch reported and the newest does not: it has none at the same place, between the same two runs."
  }
 }
}
