Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor otlp exporter #146

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

jack-berg
Copy link
Member

Resolves #103.

  • Split otlp exporter into otlp_http for HTTP transport, and otlp_grpc for gRPC transport
  • Remove otlp.protocol property
  • Remove otlp.endpoint property from required, since there is now a reasonable default.
  • otlp_http and otlp_grpc can both be set to null. Since there are no longer any required properties, its reasonable for a user to specify otlp_http:, otlp_grpc:.
  • The .insecure property is only applicable to otlp_grpc
  • Add new encoding property with values proto or json for otlp_http. Default is proto.

Unrelated changes bundled in:

  • Rename titles of exporter types to include *Exporter prefix
    • Console -> ConsoleExporter
    • Zipkin -> ZipkinExporter
    • Prometheus -> PrometheusExporter

I've prototyped this change in opentelemetry-java here.

@jack-berg jack-berg requested a review from a team as a code owner December 4, 2024 23:00
"otlp_http": {
"$ref": "common.json#/$defs/OtlpHttpExporter"
},
"otlp_grpc": {
Copy link
Member Author

@jack-berg jack-berg Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a question of whether we should align with the names of exporters in the collector, which follows the same strategy of splitting the exporter by transport:

I've chosen to not align with the collector for a couple of reasons:

  1. The collector follows a different case naming convention than this project. We prefer lower snake case, while the collector prefers something that I've seen called flatcase or mumblecase. We'd have to break our case policy to align with the collector.
  2. The collector prefers gRPC, which is an out of date default. By omitting a suffix on the grpc variant (i.e. otlp vs otlpgrpc and otlphttp instead of otlp), the collector is expressing a subtle preference for grpc. This was the original default for OTLP but OTEL has since switched course preferring HTTP. In the naming convention I've chosen, HTTP and gRPC are presented as equals. I don't think we should express a preference, but if we did, it should be for HTTP (i.e. otlp for HTTP and otlpgrpc for gRPC). This would be confusing for collector users, so better to explicitly break rank.

schema/common.json Outdated Show resolved Hide resolved
schema/meter_provider.json Outdated Show resolved Hide resolved
Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, with only a small comment on naming (proto -> protobuf)

Copy link
Member

@marcalff marcalff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Contributor

@codeboten codeboten left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I know we're still not providing backwards compatibility guarantees, but changes like this (and previously the headers change) should be captured somewhere as being breaking changes.

Maybe it's easy enough to label the title of this PR breaking: refactor OTLP exporter so that at release time these are listed in the release notes

@jack-berg
Copy link
Member Author

Maybe it's easy enough to label the title of this PR breaking: refactor OTLP exporter so that at release time these are listed in the release notes

Let's do this. We can add a note to the release workflow indicating that breaking changes should be called out clearly in the changelog.

@jack-berg
Copy link
Member Author

Wondering if any other @open-telemetry/configuration-approvers care about this / plan on reviewing it. Happy to leave it open longer if more time is needed.

@brettmc
Copy link
Contributor

brettmc commented Dec 20, 2024

care about this / plan on reviewing it. Happy to leave it open longer if more time is needed

I'd like a day or two to review this please

@jack-berg
Copy link
Member Author

At this point, might as well leave it open until the new year. No rush as this doesn't hold up anything between now and then.

@brettmc
Copy link
Contributor

brettmc commented Dec 21, 2024

Here's an alternative for consideration. I also included the in-development otlp file exporter

config.yaml
tracer_provider:
    processors:
        - batch:
            exporter:
                otlp:
                    transport:
                        http:
                            encoding: protobuf
                            headers:
                                - name: api-key
                                  value: "1234"
                            endpoint: http://localhost:4318/v1/traces
                            timeout: 10000
        - batch:
            exporter:
                otlp:
                    transport:
                        http:
                            encoding: json
                            endpoint: http://localhost:4318/v1/traces
                            compression: gzip
                            timeout: 10000
        - batch:
            exporter:
                otlp:
                    transport:
                        grpc:
                            insecure: true
                            endpoint: localhost:4317
                            certificate: /app/cert.pem
                            client_certificate: /app/cert.pem
        - batch:
            exporter:
                otlp:
                    transport:
                        file:
                            stream: stdout #default value
        - batch:
            exporter:
                otlp:
                    transport:
                        file:
                            stream: /path/to/traces.jsonl

The transport key is possibly not required, but I think it enhances readability...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Simplify endpoint
4 participants