{
  "type": "record",
  "Aspect": {
    "name": "monitorAnomalyEvent",
    "type": "timeseries"
  },
  "name": "MonitorAnomalyEvent",
  "namespace": "com.linkedin.pegasus2avro.anomaly",
  "fields": [
    {
      "type": "long",
      "name": "timestampMillis",
      "doc": "The event timestamp field as epoch at UTC in milli seconds."
    },
    {
      "type": [
        "null",
        {
          "type": "record",
          "name": "TimeWindowSize",
          "namespace": "com.linkedin.pegasus2avro.timeseries",
          "fields": [
            {
              "type": {
                "type": "enum",
                "name": "CalendarInterval",
                "namespace": "com.linkedin.pegasus2avro.timeseries",
                "symbols": [
                  "SECOND",
                  "MINUTE",
                  "HOUR",
                  "DAY",
                  "WEEK",
                  "MONTH",
                  "QUARTER",
                  "YEAR"
                ]
              },
              "name": "unit",
              "doc": "Interval unit such as minute/hour/day etc."
            },
            {
              "type": "int",
              "name": "multiple",
              "default": 1,
              "doc": "How many units. Defaults to 1."
            }
          ],
          "doc": "Defines the size of a time window."
        }
      ],
      "name": "eventGranularity",
      "default": null,
      "doc": "Granularity of the event if applicable"
    },
    {
      "type": [
        {
          "type": "record",
          "name": "PartitionSpec",
          "namespace": "com.linkedin.pegasus2avro.timeseries",
          "fields": [
            {
              "TimeseriesField": {},
              "type": "string",
              "name": "partition",
              "doc": "A unique id / value for the partition for which statistics were collected,\ngenerated by applying the key definition to a given row."
            },
            {
              "type": [
                "null",
                {
                  "type": "record",
                  "name": "TimeWindow",
                  "namespace": "com.linkedin.pegasus2avro.timeseries",
                  "fields": [
                    {
                      "type": "long",
                      "name": "startTimeMillis",
                      "doc": "Start time as epoch at UTC."
                    },
                    {
                      "type": "com.linkedin.pegasus2avro.timeseries.TimeWindowSize",
                      "name": "length",
                      "doc": "The length of the window."
                    }
                  ]
                }
              ],
              "name": "timePartition",
              "default": null,
              "doc": "Time window of the partition, if we are able to extract it from the partition key."
            },
            {
              "deprecated": true,
              "type": {
                "type": "enum",
                "name": "PartitionType",
                "namespace": "com.linkedin.pegasus2avro.timeseries",
                "symbols": [
                  "FULL_TABLE",
                  "QUERY",
                  "PARTITION"
                ]
              },
              "name": "type",
              "default": "PARTITION",
              "doc": "Unused!"
            }
          ],
          "doc": "A reference to a specific partition in a dataset."
        },
        "null"
      ],
      "name": "partitionSpec",
      "default": {
        "partition": "FULL_TABLE_SNAPSHOT",
        "type": "FULL_TABLE",
        "timePartition": null
      },
      "doc": "The optional partition specification."
    },
    {
      "type": [
        "null",
        "string"
      ],
      "name": "messageId",
      "default": null,
      "doc": "The optional messageId, if provided serves as a custom user-defined unique identifier for an aspect value."
    },
    {
      "TimeseriesField": {},
      "type": [
        "null",
        {
          "type": "enum",
          "symbolDocs": {
            "CONFIRMED": "The anomaly has been confirmed by a human reviewer. This means the anomaly was validated.",
            "REJECTED": "The anomaly has been dismissed, or ignored, by a human reviewer. This means the anomaly should have been ignored."
          },
          "name": "AnomalyReviewState",
          "namespace": "com.linkedin.pegasus2avro.anomaly",
          "symbols": [
            "CONFIRMED",
            "REJECTED"
          ]
        }
      ],
      "name": "state",
      "default": null,
      "doc": "The review of the anomaly, based on human-provided feedback.\nIf this is not present, then the Anomaly has not yet been reviewed."
    },
    {
      "type": {
        "type": "record",
        "name": "AnomalySource",
        "namespace": "com.linkedin.pegasus2avro.anomaly",
        "fields": [
          {
            "type": {
              "type": "enum",
              "symbolDocs": {
                "INFERRED_ASSERTION_FAILURE": "An assertion has failed, triggering the anomaly report.",
                "USER_FEEDBACK": "An anomaly was reported by a user."
              },
              "name": "AnomalySourceType",
              "namespace": "com.linkedin.pegasus2avro.anomaly",
              "symbols": [
                "INFERRED_ASSERTION_FAILURE",
                "USER_FEEDBACK"
              ]
            },
            "name": "type",
            "doc": "How this feedback was provided."
          },
          {
            "TimeseriesField": {},
            "UrnValidation": {
              "entityTypes": [
                "assertion"
              ],
              "exist": false,
              "strict": true
            },
            "java": {
              "class": "com.linkedin.pegasus2avro.common.urn.Urn"
            },
            "type": [
              "null",
              "string"
            ],
            "name": "sourceUrn",
            "default": null,
            "doc": "Reference to an URN related to the source of an anomaly.\nFor assertion monitors, this will contain the urn of the source Assertion.",
            "Urn": "Urn"
          },
          {
            "TimeseriesField": {},
            "type": [
              "null",
              "long"
            ],
            "name": "sourceEventTimestampMillis",
            "default": null,
            "doc": "The timestamp of the event that triggered the anomaly.\nFor assertion monitors, this will be the timestamp of the assertion run event."
          },
          {
            "type": [
              "null",
              {
                "type": "record",
                "name": "AnomalySourceProperties",
                "namespace": "com.linkedin.pegasus2avro.anomaly",
                "fields": [
                  {
                    "type": [
                      "null",
                      {
                        "type": "record",
                        "name": "AssertionMetric",
                        "namespace": "com.linkedin.pegasus2avro.assertion",
                        "fields": [
                          {
                            "type": "long",
                            "name": "timestampMs",
                            "doc": "The timestamp associated with the metric sampling time in milliseconds since epoch"
                          },
                          {
                            "type": "float",
                            "name": "value",
                            "doc": "The value of the metric that was sampled"
                          }
                        ]
                      }
                    ],
                    "name": "assertionMetric",
                    "default": null,
                    "doc": "The monitor metric associated with the anomaly, if generated from an assertion monitor (the norm)."
                  },
                  {
                    "type": [
                      "null",
                      {
                        "type": "record",
                        "name": "OperationRange",
                        "namespace": "com.linkedin.pegasus2avro.anomaly",
                        "fields": [
                          {
                            "type": "long",
                            "name": "startTimestampMillis",
                            "doc": "The start timestamp of the operation in milliseconds since epoch."
                          },
                          {
                            "type": "long",
                            "name": "endTimestampMillis",
                            "doc": "The end timestamp of the operation in milliseconds since epoch."
                          }
                        ],
                        "doc": "The time range of the anomalous operation."
                      }
                    ],
                    "name": "operationRange",
                    "default": null,
                    "doc": "The operation range associated with the anomaly, if generated from an assertion monitor (the norm).\nThis is specific to freshness assertions."
                  }
                ],
                "doc": "Ad-hoc properties about an anomaly source."
              }
            ],
            "name": "properties",
            "default": null,
            "doc": "Additional properties about the source, for example which metric\nof an assertion generated the anomaly."
          }
        ],
        "doc": "Information about the source of feedback for an anomaly raised on an asset."
      },
      "name": "source",
      "doc": "The source of an anomaly, i.e. how it was generated."
    },
    {
      "TimeseriesField": {},
      "type": {
        "type": "record",
        "name": "TimeStamp",
        "namespace": "com.linkedin.pegasus2avro.common",
        "fields": [
          {
            "type": "long",
            "name": "time",
            "doc": "When did the event occur"
          },
          {
            "java": {
              "class": "com.linkedin.pegasus2avro.common.urn.Urn"
            },
            "type": [
              "null",
              "string"
            ],
            "name": "actor",
            "default": null,
            "doc": "Optional: The actor urn involved in the event.",
            "Urn": "Urn"
          }
        ],
        "doc": "A standard event timestamp"
      },
      "name": "created",
      "doc": "@Deprecated: this matches the timestampMillis field in the TimeseriesAspectBase."
    },
    {
      "TimeseriesField": {},
      "type": "com.linkedin.pegasus2avro.common.TimeStamp",
      "name": "lastUpdated",
      "doc": "The time at which the anomaly was last updated\n@Deprecated: this field is not used as this is an immutable log."
    }
  ],
  "doc": "A feedback log of anomalies detected by a monitor\nNOTE: this is an immutable log. The most recent entry for a given run can be used to determine the state of the anomaly."
}