{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://catalog.lintel.tools/schemas/schemastore/ory-kratos-configuration/_shared/latest--config.schema.json",
  "description": "Configure distributed tracing using OpenTelemetry",
  "x-lintel": {
    "source": "https://raw.githubusercontent.com/ory/x/v0.0.623/otelx/config.schema.json",
    "sourceSha256": "fa2bbb9af49266859ff1c5240f876985034d2fb42b90d670f2eb3b31ed5d67d6"
  },
  "type": "object",
  "properties": {
    "provider": {
      "type": "string",
      "description": "Set this to the tracing backend you wish to use. Supports Jaeger, Zipkin, and OTEL.",
      "enum": [
        "jaeger",
        "otel",
        "zipkin"
      ],
      "examples": [
        "jaeger"
      ]
    },
    "service_name": {
      "type": "string",
      "description": "Specifies the service name to use on the tracer.",
      "examples": [
        "Ory Hydra",
        "Ory Kratos",
        "Ory Keto",
        "Ory Oathkeeper"
      ]
    },
    "deployment_environment": {
      "type": "string",
      "description": "Specifies the deployment environment to use on the tracer.",
      "examples": [
        "development",
        "staging",
        "production"
      ]
    },
    "providers": {
      "type": "object",
      "properties": {
        "jaeger": {
          "type": "object",
          "properties": {
            "local_agent_address": {
              "type": "string",
              "description": "The address of the jaeger-agent where spans should be sent to.",
              "anyOf": [
                {
                  "title": "IPv6 Address and Port",
                  "pattern": "^\\[(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))]:([0-9]*)$"
                },
                {
                  "title": "IPv4 Address and Port",
                  "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}:([0-9]*)$"
                },
                {
                  "title": "Hostname and Port",
                  "pattern": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]):([0-9]*)$"
                }
              ],
              "examples": [
                "127.0.0.1:6831"
              ]
            },
            "sampling": {
              "type": "object",
              "propertyNames": {
                "enum": [
                  "server_url",
                  "trace_id_ratio"
                ]
              },
              "properties": {
                "server_url": {
                  "type": "string",
                  "description": "The address of jaeger-agent's HTTP sampling server",
                  "format": "uri",
                  "examples": [
                    "http://localhost:5778/sampling"
                  ]
                },
                "trace_id_ratio": {
                  "type": "number",
                  "description": "Trace Id ratio sample",
                  "examples": [
                    0.5
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "description": "Configures the jaeger tracing backend.",
          "additionalProperties": false
        },
        "zipkin": {
          "type": "object",
          "properties": {
            "server_url": {
              "type": "string",
              "description": "The address of the Zipkin server where spans should be sent to.",
              "format": "uri",
              "examples": [
                "http://localhost:9411/api/v2/spans"
              ]
            },
            "sampling": {
              "type": "object",
              "propertyNames": {
                "enum": [
                  "sampling_ratio"
                ]
              },
              "properties": {
                "sampling_ratio": {
                  "type": "number",
                  "description": "Sampling ratio for spans.",
                  "examples": [
                    0.4
                  ]
                }
              },
              "additionalProperties": false
            }
          },
          "description": "Configures the zipkin tracing backend.",
          "additionalProperties": false
        },
        "otlp": {
          "type": "object",
          "properties": {
            "server_url": {
              "type": "string",
              "description": "The endpoint of the OTLP exporter (HTTP) where spans should be sent to.",
              "anyOf": [
                {
                  "title": "IPv6 Address and Port",
                  "pattern": "^\\[(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))]:([0-9]*)$"
                },
                {
                  "title": "IPv4 Address and Port",
                  "pattern": "^([0-9]{1,3}\\.){3}[0-9]{1,3}:([0-9]*)$"
                },
                {
                  "title": "Hostname and Port",
                  "pattern": "^(([a-zA-Z0-9]|[a-zA-Z0-9][a-zA-Z0-9\\-]*[a-zA-Z0-9])\\.)*([A-Za-z0-9]|[A-Za-z0-9][A-Za-z0-9\\-]*[A-Za-z0-9]):([0-9]*)$"
                }
              ],
              "examples": [
                "localhost:4318"
              ]
            },
            "insecure": {
              "type": "boolean",
              "description": "Will use HTTP if set to true; defaults to HTTPS."
            },
            "sampling": {
              "type": "object",
              "propertyNames": {
                "enum": [
                  "sampling_ratio"
                ]
              },
              "properties": {
                "sampling_ratio": {
                  "type": "number",
                  "description": "Sampling ratio for spans.",
                  "examples": [
                    0.4
                  ]
                }
              },
              "additionalProperties": false
            },
            "authorization_header": {
              "type": "string",
              "examples": [
                "Bearer 2389s8fs9d8fus9f"
              ]
            }
          },
          "description": "Configures the OTLP tracing backend.",
          "additionalProperties": false
        }
      },
      "additionalProperties": false
    }
  },
  "additionalProperties": false
}
