{
  "$schema": "https://json-schema.org/draft/2019-09/schema",
  "$id": "https://www.krakend.io/schema/v2.13/telemetry/opentelemetry-endpoint.json",
  "title": "OpenTelemetry Endpoint Override",
  "description": "Enterprise only. Overrides metrics and traces declared by the OpenTelemetry service.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
  "type": "object",
  "properties": {
    "backend": {
      "title": "Report backend activity",
      "description": "Enterprise only. Reports the activity between KrakenD and each of your backend services. This is the more granular layer.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
      "type": "object",
      "properties": {
        "metrics": {
          "type": "object",
          "properties": {
            "detailed_connection": {
              "title": "Detailed HTTP connection metrics",
              "description": "Whether you want to enable detailed metrics for the HTTP connection phase or not. Includes times to connect, DNS querying, and the TLS handshake.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "disable_stage": {
              "title": "Disable this stage",
              "description": "Whether to turn off the metrics or not. Setting this to `true` means stop reporting any data.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "read_payload": {
              "title": "Detailed payload read",
              "description": "Whether you want to enable metrics for the response reading payload or not (HTTP connection not taken into account).\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "round_trip": {
              "title": "Detailed Round Trip",
              "description": "Whether you want to enable metrics for the actual HTTP request for the backend or not (manipulation not taken into account). This is the time your backend needs to produce a result.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "static_attributes": {
              "title": "Static attributes",
              "description": "A list of tags or labels you want to associate with these metrics.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "examples": [
                [
                  {
                    "key": "my_metric_attr",
                    "value": "my_metric_val"
                  }
                ]
              ],
              "type": "array",
              "items": {
                "type": "object",
                "required": [ "key", "value" ],
                "properties": {
                  "key": {
                    "title": "Key",
                    "description": "The key, tag, or label name you want to use.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
                    "type": "string"
                  },
                  "value": {
                    "title": "Value",
                    "description": "The static value you want to assign to this key.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
                    "type": "string"
                  }
                },
                "patternProperties": {
                  "^[@$_#]": true
                },
                "additionalProperties": false
              }
            }
          },
          "patternProperties": {
            "^[@$_#]": true
          },
          "additionalProperties": false
        },
        "traces": {
          "type": "object",
          "properties": {
            "detailed_connection": {
              "title": "Detailed HTTP connection",
              "description": "Whether you want to add detailed trace attributes for the HTTP connection phase or not. Includes times to connect, DNS querying, and the TLS handshake.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "disable_stage": {
              "title": "Disable this stage",
              "description": "Whether to turn off the traces or not. Setting this to `true` means stop reporting any data.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "read_payload": {
              "title": "Detailed payload read",
              "description": "Whether you want to add trace attributes for the response reading payload or not (HTTP connection not taken into account).\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "report_headers": {
              "title": "Report headers",
              "description": "Whether you want to report the final headers that reached the backend.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "round_trip": {
              "title": "Detailed Round Trip",
              "description": "Whether you want to add trace attributes for the actual HTTP request for the backend or not (manipulation not taken into account). This is the time your backend needs to produce a result.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "default": false,
              "type": "boolean"
            },
            "skip_headers": {
              "title": "Skip headers",
              "description": "A list of headers you want to skip when reporting the headers that reached the backend. This is useful to avoid reporting sensitive data.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "examples": [
                [ "X-Backend-Secret", "X-All-Secret" ]
              ],
              "type": "array",
              "items": {
                "type": "string"
              }
            },
            "static_attributes": {
              "title": "Static attributes",
              "description": "A list of tags or labels you want to associate to these traces.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
              "examples": [
                [
                  {
                    "key": "my_trace_attr",
                    "value": "my_trace_val"
                  }
                ]
              ],
              "type": "array",
              "items": {
                "type": "object",
                "required": [ "key", "value" ],
                "properties": {
                  "key": {
                    "title": "Key",
                    "description": "The key, tag, or label name you want to use.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
                    "type": "string"
                  },
                  "value": {
                    "title": "Value",
                    "description": "The static value you want to assign to this key.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
                    "type": "string"
                  }
                },
                "patternProperties": {
                  "^[@$_#]": true
                },
                "additionalProperties": false
              }
            }
          },
          "patternProperties": {
            "^[@$_#]": true
          },
          "additionalProperties": false
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    },
    "exporters_override": {
      "title": "Exporters override",
      "description": "Enterprise only. Override exporter configuration for this endpoint",
      "type": "object",
      "properties": {
        "metric_exporters": {
          "title": "Metrics exporters",
          "description": "Overrides the metrics exporters used in this endpoint",
          "examples": [
            [ "local_prometheus" ]
          ],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "metric_reporting_period": {
          "title": "Reporting period",
          "description": "Override how often you want to report and flush the metrics in seconds.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
          "type": "integer"
        },
        "trace_exporters": {
          "title": "Trace exporters",
          "description": "Overrides the trace exporters used in this endpoint",
          "examples": [
            [ "debug_jaeger", "newrelic", "local_tempo" ]
          ],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "trace_sample_rate": {
          "title": "Trace sample rate",
          "description": "Overrides the sample rate for traces defines the percentage of reported traces. This option is key to reduce the amount of data generated (and resource usage), while you still can debug and troubleshoot issues. For instance, a number of `0.25` will report a 25% of the traces seen in the system.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
          "examples": [ 0.25 ],
          "type": "number",
          "maximum": 1,
          "minimum": 0
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    },
    "global": {
      "title": "Replace global configuration",
      "description": "Overrides the global configuration for this endpoint.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
      "properties": {
        "metrics_static_attributes": {
          "title": "Static attributes",
          "description": "Static attributes you want to pass for metrics. Overrides the `metrics_static_attributes` defined at the service level.",
          "type": "array",
          "items": {
            "properties": {
              "key": {
                "title": "Key",
                "description": "The key of the static attribute you want to send",
                "type": "string"
              },
              "value": {
                "title": "Value",
                "description": "The value of the static attribute you want to send",
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "traces_static_attributes": {
          "title": "Static attributes",
          "description": "Static attributes you want to pass for traces.  Overrides the `traces_static_attributes` defined at the service level.",
          "type": "array",
          "items": {
            "properties": {
              "key": {
                "title": "Key",
                "description": "The key of the static attribute you want to send",
                "type": "string"
              },
              "value": {
                "title": "Value",
                "description": "The value of the static attribute you want to send",
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    },
    "proxy": {
      "title": "Report proxy activity",
      "description": "Reports the activity at the beginning of the proxy layer, including spawning the required requests to multiple backends, merging, endpoint transformation and any other internals of the proxy between the request processing and the backend communication\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
      "type": "object",
      "properties": {
        "disable_metrics": {
          "title": "Disable metrics",
          "description": "Whether you want to disable all metrics in this endpoint or not.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
          "default": false,
          "type": "boolean"
        },
        "disable_traces": {
          "title": "Disable traces",
          "description": "Whether you want to disable all traces in this endpoint or not.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry-by-endpoint/",
          "default": false,
          "type": "boolean"
        },
        "metrics_static_attributes": {
          "title": "Static attributes",
          "description": "Static attributes you want to pass for metrics.",
          "type": "array",
          "items": {
            "properties": {
              "key": {
                "title": "Key",
                "description": "The key of the static attribute you want to send",
                "type": "string"
              },
              "value": {
                "title": "Value",
                "description": "The value of the static attribute you want to send",
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        },
        "report_headers": {
          "title": "Report headers",
          "description": "Whether you want to report all headers that passed from the request to the proxy layer (`input_headers` policy in the endpoint plus KrakenD's headers).\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
          "default": false,
          "type": "boolean"
        },
        "skip_headers": {
          "title": "Skip headers",
          "description": "A list of headers you want to skip when reporting headers passed to the proxy layer. This is useful to avoid reporting sensitive data.\n\nSee: https://www.krakend.io/docs/telemetry/opentelemetry/",
          "examples": [
            [ "X-Sensitive-Data", "X-Signature" ]
          ],
          "type": "array",
          "items": {
            "type": "string"
          }
        },
        "traces_static_attributes": {
          "title": "Static attributes",
          "description": "Static attributes you want to pass for traces.",
          "type": "array",
          "items": {
            "properties": {
              "key": {
                "title": "Key",
                "description": "The key of the static attribute you want to send",
                "type": "string"
              },
              "value": {
                "title": "Value",
                "description": "The value of the static attribute you want to send",
                "type": "string"
              }
            },
            "additionalProperties": false
          }
        }
      },
      "patternProperties": {
        "^[@$_#]": true
      },
      "additionalProperties": false
    }
  },
  "patternProperties": {
    "^[@$_#]": true
  },
  "additionalProperties": false
}
