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

[collectd 6] Add OTLP support to the Write HTTP plugin. #4188

Merged
merged 19 commits into from
Jan 3, 2024

Conversation

octo
Copy link
Member

@octo octo commented Dec 14, 2023

The protocol is described here: https://opentelemetry.io/docs/specs/otlp/#otlphttp

ChangeLog: Write HTTP plugin: Support for the OpenTelemetry protocol (OTLP) has been added.

@collectd-bot collectd-bot added this to the 6.0 milestone Dec 14, 2023
Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

ChangeLog: Write HTTP plugin: Support for the OpenTelemetry protocol (OTLP) has been added.

There's no caller for format_json_open_telemetry(), and the otlp functions in the write_http plugin are just stubs?

=> For now I'm just commenting on the error logging...

src/utils/format_json/open_telemetry.c Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Outdated Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Outdated Show resolved Hide resolved
@octo
Copy link
Member Author

octo commented Dec 15, 2023

Hey @eero-t, thanks for your comments! I'll address them shortly.

This PR is still a draft and work in progress. Current state:

  • The changes in src/utils/format_json/ are ready to be reviewed.
  • Changes to the write_http plugin are largely missing, see below.

The existing formats encode each metric family individually and append the encoded metric family to a buffer. We could do the same for the JSON output but we can't do that for the binary protobuf output.

What I'd prefer to do is what the write_open_telemetry plugin is also doing: stage metric families and convert them all to the desired format inside the flush callback/function. This allows us to (eventually) group metric families by their resource attributes, reducing the size of the generated payload.

src/utils/format_json/open_telemetry.c Outdated Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Outdated Show resolved Hide resolved
@octo octo marked this pull request as ready for review December 16, 2023 18:10
@octo octo requested review from a team as code owners December 16, 2023 18:10
@octo octo force-pushed the 6/write_http_otlp_json branch 2 times, most recently from 4337dce to b4457d7 Compare December 17, 2023 08:50
@octo
Copy link
Member Author

octo commented Dec 17, 2023

This is now ready for review.

This PR and #4180 share commits that introduce the resource_metrics utility. I'm happy to create a separate PR just for that utility to make the review simpler. Just let me know.

@eero-t
Copy link
Contributor

eero-t commented Dec 18, 2023

This PR and #4180 share commits that introduce the resource_metrics utility. I'm happy to create a separate PR just for that utility to make the review simpler. Just let me know.

Yes, please do that.

@octo
Copy link
Member Author

octo commented Dec 18, 2023

Yes, please do that.

Done: #4196

@eero-t
Copy link
Contributor

eero-t commented Dec 29, 2023

Btw. according to this: influxdata/telegraf#6205

OpenTelemetry input plugin would mean collectd supporting also Jaeger clients (applications providing cluster request tracing data).

@octo
Copy link
Member Author

octo commented Dec 29, 2023

OpenTelemetry knows three distinct types: metrics, traces, and logs. At the moment we only have support for metrics. I think collectd could potentially send its logs to OpenTelemetry, but I'm not sure if collectd would provide value as traces and/or logs broker.

@eero-t
Copy link
Contributor

eero-t commented Dec 29, 2023

Hm. Traces appear to be hierarchical / structured "logs": https://opentelemetry.io/docs/concepts/signals/traces/

=> Yeah, that could indeed be awkward to support. Better to advance in smaller steps and get initial support ready first, and a release of it out.

(If given application already has network port open, I guess it could as well offer it to outside the node, not just to a node-local trace broker like collectd.)

@octo octo modified the milestones: 6.0, 6 MVP Jan 3, 2024
@octo
Copy link
Member Author

octo commented Jan 3, 2024

Hey @eero-t, I'd like to merge this. Is there anything else you'd like to see changed before that?

Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

Looks OK on quick look, but I have few minor comments.

src/collectd.conf.pod Outdated Show resolved Hide resolved
src/collectd.conf.pod Outdated Show resolved Hide resolved
src/utils/format_json/format_json_test.c Outdated Show resolved Hide resolved
src/utils/format_json/open_telemetry.c Outdated Show resolved Hide resolved
src/write_http.c Outdated Show resolved Hide resolved
Copy link
Contributor

@eero-t eero-t left a comment

Choose a reason for hiding this comment

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

Looks fine to me now.

@octo
Copy link
Member Author

octo commented Jan 3, 2024

Thanks @eero-t!

@octo octo merged commit 48e5a60 into collectd:collectd-6.0 Jan 3, 2024
23 checks passed
@octo octo deleted the 6/write_http_otlp_json branch January 3, 2024 15:52
@octo octo added the Feature label Jan 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants