{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/grepr/json-schema/grepr-dataset-estimation-config-schema.json",
  "title": "DatasetEstimationConfig",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/grepr-datasets-api-openapi.yml#/components/schemas/DatasetEstimationConfig",
  "properties": {
    "createdAt": {
      "format": "date-time",
      "readOnly": true,
      "type": "string"
    },
    "datasetId": {
      "readOnly": true,
      "type": "string"
    },
    "logLimit": {
      "default": 10000000,
      "description": "Maximum number of log messages to scan per estimation run.",
      "format": "int32",
      "maximum": 2147483647,
      "type": "integer"
    },
    "lookbackDuration": {
      "default": "PT1H",
      "description": "Time window of data to scan per estimation run. ISO-8601 duration format.",
      "format": "ISO-8601",
      "type": "string"
    },
    "organizationId": {
      "readOnly": true,
      "type": "string"
    },
    "query": {
      "$ref": "#/$defs/EventPredicate"
    },
    "refreshPeriod": {
      "default": "PT168H",
      "description": "How often to recalculate impact percentages. ISO-8601 duration format.",
      "format": "ISO-8601",
      "type": "string"
    },
    "updatedAt": {
      "format": "date-time",
      "readOnly": true,
      "type": "string"
    }
  },
  "required": [
    "logLimit",
    "lookbackDuration",
    "refreshPeriod"
  ],
  "type": "object",
  "$defs": {
    "AndEventPredicate": {
      "properties": {
        "queries": {
          "default": [],
          "description": "List of predicates that must all match for this predicate to match.",
          "items": {
            "$ref": "#/$defs/EventPredicate"
          },
          "maxItems": 2147483647,
          "minItems": 1,
          "title": "Child predicates",
          "type": "array"
        },
        "type": {
          "description": "A predicate that matches when every child predicate matches.",
          "enum": [
            "and-predicate"
          ],
          "type": "string"
        }
      },
      "required": [
        "queries",
        "type"
      ],
      "type": "object"
    },
    "DatadogQueryPredicate": {
      "properties": {
        "query": {
          "default": "",
          "description": "The datadog query used by the predicate. See https://docs.datadoghq.com/tracing/trace_explorer/query_syntax",
          "type": "string"
        },
        "type": {
          "description": "A predicate that checks if an event matches a datadog query.",
          "enum": [
            "datadog-query"
          ],
          "type": "string"
        }
      },
      "required": [
        "query",
        "type"
      ],
      "type": "object"
    },
    "EventPredicate": {
      "description": "Predicate applied to rows before analytical aggregation.",
      "oneOf": [
        {
          "$ref": "#/$defs/AndEventPredicate"
        },
        {
          "$ref": "#/$defs/DatadogQueryPredicate"
        },
        {
          "$ref": "#/$defs/MetricEventPredicate"
        },
        {
          "$ref": "#/$defs/NewRelicQueryPredicate"
        },
        {
          "$ref": "#/$defs/NrqlQueryPredicate"
        }
      ],
      "properties": {
        "query": {
          "type": "string"
        },
        "type": {
          "type": "string"
        }
      },
      "required": [
        "type"
      ],
      "type": "object"
    },
    "MetricEventPredicate": {
      "properties": {
        "filterTags": {
          "additionalProperties": {
            "default": {},
            "description": "The set of tags to query for. If unspecified, all tags are queried.",
            "items": {
              "default": "{}",
              "description": "The set of tags to query for. If unspecified, all tags are queried.",
              "type": "string"
            },
            "type": "array",
            "uniqueItems": true
          },
          "default": {},
          "description": "The set of tags to query for. If unspecified, all tags are queried.",
          "type": "object"
        },
        "metricNames": {
          "default": [],
          "description": "The names of the metrics to query. Must not be empty.",
          "items": {
            "description": "The names of the metrics to query. Must not be empty.",
            "type": "string"
          },
          "maxItems": 2147483647,
          "minItems": 1,
          "type": "array"
        },
        "query": {
          "type": "string"
        },
        "type": {
          "description": "A predicate that checks if an event matches a metrics query.",
          "enum": [
            "metric-predicate"
          ],
          "type": "string"
        }
      },
      "required": [
        "metricNames",
        "query",
        "type"
      ],
      "type": "object"
    },
    "NewRelicQueryPredicate": {
      "properties": {
        "query": {
          "default": "",
          "description": "The New Relic query used by the predicate. See https://docs.newrelic.com/docs/logs/ui-data/query-syntax-logs/ ",
          "type": "string"
        },
        "type": {
          "description": "A predicate that checks if an event matches a New Relic query.",
          "enum": [
            "newrelic-query"
          ],
          "type": "string"
        }
      },
      "required": [
        "query",
        "type"
      ],
      "type": "object"
    },
    "NrqlQueryPredicate": {
      "properties": {
        "query": {
          "default": "",
          "description": "The Nrql query used by the predicate. See https://docs.newrelic.com/docs/nrql",
          "type": "string"
        },
        "strict": {
          "default": true,
          "description": "Whether the query should be parsed in strict mode.",
          "type": "boolean"
        },
        "type": {
          "description": "A predicate that checks if an event matches an NRQL query.",
          "enum": [
            "nrql-query"
          ],
          "type": "string"
        }
      },
      "required": [
        "query",
        "type"
      ],
      "type": "object"
    }
  }
}