{
  "description": "See also https://coralogix.com/docs/user-guides/monitoring-and-insights/events2metrics/\n\n**Added in v0.5.0**\nEvents2Metric is the Schema for the events2metrics API.",
  "properties": {
    "apiVersion": {
      "description": "APIVersion defines the versioned schema of this representation of an object.\nServers should convert recognized schemas to the latest internal value, and\nmay reject unrecognized values.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#resources",
      "type": "string"
    },
    "kind": {
      "description": "Kind is a string value representing the REST resource this object represents.\nServers may infer this from the endpoint the client submits requests to.\nCannot be updated.\nIn CamelCase.\nMore info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds",
      "type": "string"
    },
    "metadata": {
      "type": "object"
    },
    "spec": {
      "description": "Events2MetricSpec defines the desired state of Events2Metric.",
      "properties": {
        "dataSource": {
          "description": "Data source in <namespace>/<dataset_name> format. If not set, defaults to the standard logs/spans stream.",
          "type": "string"
        },
        "description": {
          "description": "Description of the E2M",
          "type": "string"
        },
        "metricFields": {
          "description": "E2M metric fields",
          "items": {
            "properties": {
              "aggregations": {
                "description": "Represents Aggregation type list",
                "items": {
                  "properties": {
                    "aggMetadata": {
                      "description": "Aggregate metadata, samples or histogram type. Only relevant for the samples and histogram\naggregation types; leave both samples and histogram unset for min/max/count/avg/sum.",
                      "properties": {
                        "histogram": {
                          "description": "E2M aggregate histogram type metadata",
                          "properties": {
                            "buckets": {
                              "description": "Buckets of the E2M",
                              "items": {
                                "anyOf": [
                                  {
                                    "type": "integer"
                                  },
                                  {
                                    "type": "string"
                                  }
                                ],
                                "pattern": "^(\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))(([KMGTPE]i)|[numkMGTPE]|([eE](\\+|-)?(([0-9]+(\\.[0-9]*)?)|(\\.[0-9]+))))?$",
                                "x-kubernetes-int-or-string": true
                              },
                              "type": "array"
                            }
                          },
                          "required": [
                            "buckets"
                          ],
                          "type": "object",
                          "additionalProperties": false
                        },
                        "samples": {
                          "description": "E2M sample type metadata",
                          "properties": {
                            "sampleType": {
                              "description": "E2MAggSamplesSampleType defines the type of sample aggregation to be performed.",
                              "enum": [
                                "min",
                                "max"
                              ],
                              "type": "string"
                            }
                          },
                          "required": [
                            "sampleType"
                          ],
                          "type": "object",
                          "additionalProperties": false
                        }
                      },
                      "type": "object",
                      "x-kubernetes-validations": [
                        {
                          "message": "At most one of samples or histogram may be set",
                          "rule": "!(has(self.samples) && has(self.histogram))"
                        }
                      ],
                      "additionalProperties": false
                    },
                    "aggType": {
                      "description": "Aggregation type",
                      "enum": [
                        "min",
                        "max",
                        "count",
                        "avg",
                        "sum",
                        "histogram",
                        "samples"
                      ],
                      "type": "string"
                    },
                    "enabled": {
                      "default": true,
                      "description": "Is enabled. True by default",
                      "type": "boolean"
                    },
                    "targetMetricName": {
                      "description": "Target metric field alias name",
                      "type": "string"
                    }
                  },
                  "required": [
                    "aggMetadata",
                    "aggType",
                    "enabled",
                    "targetMetricName"
                  ],
                  "type": "object",
                  "additionalProperties": false
                },
                "type": "array"
              },
              "sourceField": {
                "description": "Source field",
                "type": "string"
              },
              "targetBaseMetricName": {
                "description": "Target metric field alias name",
                "type": "string"
              }
            },
            "required": [
              "sourceField",
              "targetBaseMetricName"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "metricLabels": {
          "description": "E2M metric labels",
          "items": {
            "properties": {
              "sourceField": {
                "description": "Metric label source field",
                "type": "string"
              },
              "targetLabel": {
                "description": "Metric label target alias name",
                "type": "string"
              }
            },
            "required": [
              "sourceField",
              "targetLabel"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "name": {
          "description": "Name of the E2M",
          "type": "string"
        },
        "permutationsLimit": {
          "description": "Represents the limit of the permutations",
          "format": "int32",
          "type": "integer"
        },
        "query": {
          "description": "Spans or logs type query",
          "properties": {
            "logs": {
              "description": "Logs query for logs2metrics E2M",
              "properties": {
                "alias": {
                  "description": "alias",
                  "type": "string"
                },
                "applicationNameFilters": {
                  "description": "application name filters",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "lucene": {
                  "description": "lucene query",
                  "type": "string"
                },
                "severityFilters": {
                  "description": "severity type filters",
                  "items": {
                    "description": "L2MSeverity defines the severity type for logs2metrics E2M.",
                    "enum": [
                      "debug",
                      "verbose",
                      "info",
                      "warn",
                      "error",
                      "critical"
                    ],
                    "type": "string"
                  },
                  "type": "array"
                },
                "subsystemNameFilters": {
                  "description": "subsystem names filters",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              },
              "type": "object",
              "additionalProperties": false
            },
            "spans": {
              "description": "Spans query for spans2metrics E2M",
              "properties": {
                "actionFilters": {
                  "description": "action filters",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "applicationNameFilters": {
                  "description": "application name filters",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "lucene": {
                  "description": "lucene query",
                  "type": "string"
                },
                "serviceFilters": {
                  "description": "service filters",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                },
                "subsystemNameFilters": {
                  "description": "subsystem name filters",
                  "items": {
                    "type": "string"
                  },
                  "type": "array"
                }
              },
              "type": "object",
              "additionalProperties": false
            }
          },
          "type": "object",
          "x-kubernetes-validations": [
            {
              "message": "Exactly one of spans or logs must be set",
              "rule": "has(self.spans) != has(self.logs)"
            }
          ],
          "additionalProperties": false
        }
      },
      "required": [
        "name",
        "query"
      ],
      "type": "object",
      "additionalProperties": false
    },
    "status": {
      "description": "Events2MetricStatus defines the observed state of Events2Metric.",
      "properties": {
        "conditions": {
          "items": {
            "description": "Condition contains details for one aspect of the current state of this API Resource.",
            "properties": {
              "lastTransitionTime": {
                "description": "lastTransitionTime is the last time the condition transitioned from one status to another.\nThis should be when the underlying condition changed.  If that is not known, then using the time when the API field changed is acceptable.",
                "format": "date-time",
                "type": "string"
              },
              "message": {
                "description": "message is a human readable message indicating details about the transition.\nThis may be an empty string.",
                "maxLength": 32768,
                "type": "string"
              },
              "observedGeneration": {
                "description": "observedGeneration represents the .metadata.generation that the condition was set based upon.\nFor instance, if .metadata.generation is currently 12, but the .status.conditions[x].observedGeneration is 9, the condition is out of date\nwith respect to the current state of the instance.",
                "format": "int64",
                "minimum": 0,
                "type": "integer"
              },
              "reason": {
                "description": "reason contains a programmatic identifier indicating the reason for the condition's last transition.\nProducers of specific condition types may define expected values and meanings for this field,\nand whether the values are considered a guaranteed API.\nThe value should be a CamelCase string.\nThis field may not be empty.",
                "maxLength": 1024,
                "minLength": 1,
                "pattern": "^[A-Za-z]([A-Za-z0-9_,:]*[A-Za-z0-9_])?$",
                "type": "string"
              },
              "status": {
                "description": "status of the condition, one of True, False, Unknown.",
                "enum": [
                  "True",
                  "False",
                  "Unknown"
                ],
                "type": "string"
              },
              "type": {
                "description": "type of condition in CamelCase or in foo.example.com/CamelCase.",
                "maxLength": 316,
                "pattern": "^([a-z0-9]([-a-z0-9]*[a-z0-9])?(\\.[a-z0-9]([-a-z0-9]*[a-z0-9])?)*/)?(([A-Za-z0-9][-A-Za-z0-9_.]*)?[A-Za-z0-9])$",
                "type": "string"
              }
            },
            "required": [
              "lastTransitionTime",
              "message",
              "reason",
              "status",
              "type"
            ],
            "type": "object",
            "additionalProperties": false
          },
          "type": "array"
        },
        "id": {
          "type": "string"
        },
        "printableStatus": {
          "type": "string"
        }
      },
      "type": "object",
      "additionalProperties": false
    }
  },
  "type": "object"
}
