{
  "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."
              },
              "name": "AnomalySourceType",
              "namespace": "com.linkedin.pegasus2avro.anomaly",
              "symbols": [
                "INFERRED_ASSERTION_FAILURE"
              ]
            },
            "name": "type",
            "doc": "Message associated with the anomaly"
          },
          {
            "TimeseriesField": {},
            "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.\nIf this anomaly was raised due to an inferred assertion failure, then this will contain the urn of the source Assertion.",
            "Urn": "Urn"
          },
          {
            "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)."
                  }
                ],
                "doc": "Ad-hoc properties about an anomaly source."
              }
            ],
            "name": "properties",
            "default": null,
            "doc": "Additional properties about the source, for example which evaluation\nof an assertion generated an Anomaly."
          }
        ],
        "doc": "Information about the source of 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": "The time at which the request was initially created"
    },
    {
      "TimeseriesField": {},
      "type": "com.linkedin.pegasus2avro.common.TimeStamp",
      "name": "lastUpdated",
      "doc": "The time at which the request was initially created"
    }
  ],
  "doc": "Information about an anomaly generated by a monitor"
}