Skip to content

Decouple exporters from processors #421

@thompson-tomo

Description

@thompson-tomo

Looking at the schema definition one of things which has stood out is the the way in which extension points can be nested within extension points. This works ok when it is being centrally managed however it adds complexity when you start to think about the amount of integrations we have.

What I would like to propose is decoupling exporters from being children of processors to being sibling. This change would result in the following:

{
    "$id": "https://opentelemetry.io/otelconfig/logger_provider.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "processors": {
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "#/$defs/LogRecordProcessor"
            }
        }
....
    },
    "required": [
        "processors"
    ],
    "$defs": {
        "SimpleLogRecordProcessor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
....
                "exporter": {
                    "$ref": "#/$defs/LogRecordExporter"
                }
            },
            "required": [
                "exporter"
            ]
        },
        "BatchLogRecordProcessor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
....
                "exporter": {
                    "$ref": "#/$defs/LogRecordExporter"
                }
            },
            "required": [
                "exporter"
            ]
        },
        "LogRecordExporter": {
            "type": "object",
            "additionalProperties": {
                "type": ["object", "null"]
            },
            "minProperties": 1,
            "maxProperties": 1,
            "properties": {
                "otlp_http": {
                    "$ref": "common.json#/$defs/OtlpHttpExporter"
                },
                "otlp_grpc": {
                    "$ref": "common.json#/$defs/OtlpGrpcExporter"
                },
                "otlp_file/development": {
                    "$ref": "common.json#/$defs/ExperimentalOtlpFileExporter"
                },
                "console": {
                    "$ref": "common.json#/$defs/ConsoleExporter"
                }
            }
        },
        "LogRecordProcessor": {
            "type": "object",
            "additionalProperties": {
                "type": ["object", "null"]
            },
            "minProperties": 1,
            "maxProperties": 1,
            "properties": {
                "batch": {
                    "$ref": "#/$defs/BatchLogRecordProcessor"
                },
                "simple": {
                    "$ref": "#/$defs/SimpleLogRecordProcessor"
                }
            }
        }
   }
}

Becoming

{
    "$id": "https://opentelemetry.io/otelconfig/logger_provider.json",
    "$schema": "https://json-schema.org/draft/2020-12/schema",
    "type": "object",
    "additionalProperties": false,
    "properties": {
        "processors": {
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "#/$defs/LogRecordProcessor"
            }
        },
        "exporters": {
            "type": "array",
            "minItems": 1,
            "items": {
                "$ref": "#/$defs/LogRecordExporter"
            }
....
    },
    "required": [
        "processors", ""
    ],
    "$defs": {
        "SimpleLogRecordProcessor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
....
            }
        },
        "BatchLogRecordProcessor": {
            "type": "object",
            "additionalProperties": false,
            "properties": {
....
            }
        },
        "LogRecordExporter": {
            "type": "object",
            "additionalProperties": {
                "type": ["object", "null"]
            },
            "minProperties": 1,
            "maxProperties": 1,
            "properties": {
                "otlp_http": {
                    "$ref": "common.json#/$defs/OtlpHttpExporter"
                },
                "otlp_grpc": {
                    "$ref": "common.json#/$defs/OtlpGrpcExporter"
                },
                "otlp_file/development": {
                    "$ref": "common.json#/$defs/ExperimentalOtlpFileExporter"
                },
                "console": {
                    "$ref": "common.json#/$defs/ConsoleExporter"
                }
            }
        },
        "LogRecordProcessor": {
            "type": "object",
            "additionalProperties": {
                "type": ["object", "null"]
            },
            "minProperties": 1,
            "maxProperties": 1,
            "properties": {
                "batch": {
                    "$ref": "#/$defs/BatchLogRecordProcessor"
                },
                "simple": {
                    "$ref": "#/$defs/SimpleLogRecordProcessor"
                }
            }
        }
   }
}

With this change there is no requirement on processor to define an exporter field which is a big plus if we get a position of collecting schemas for all the different otel components. It would also better enable Scoping of config exposed to modules to only be what is needed.

This approach also ties into the collector & sdk's which are already use to having processors & exporters.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions