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

[exporter/syslog] send syslog messages in batches #27799

Merged

Conversation

andrzej-stencel
Copy link
Member

@andrzej-stencel andrzej-stencel commented Oct 17, 2023

Description:

This changes the behavior of the Syslog exporter to send each batch of Syslog messages in a single request (with messages separated by newlines), instead of sending each message in a separate request and closing the connection after each message.

The batching only happens when using TCP. For UDP, each syslog message is still sent in a separate request, as defined by the spec.

This also significantly refactors (and hopefully simplifies) the exporter's code, extracting the code that formats the syslog messages from the sender type into separate formatter types. Hopefully this will make the development of this component easier.

Link to tracking Issue:

Testing:

The unit tests have been updated to reflect the refactored codebase. The integration tests introduced in #27464 are unchanged, as the format of the output messages hasn't changed.

Documentation:

No documentation updates.

This changes the behavior of the Syslog exporter
to send each batch of syslog messages in a single request
(with messages separated by newlines),
instead of sending each message in a separate request
and closing the connection after each message.

This also significantly refactors (and hopefully simplifies) the exporter's code,
extracting the code that formats the Syslog messages
from the `sender` type into separate `formatter` types.
Hopefully this will make the development of this component easier.
@andrzej-stencel andrzej-stencel force-pushed the syslog-exporter-performance branch from c83790a to 421407a Compare October 17, 2023 11:35
According to https://datatracker.ietf.org/doc/html/rfc5426#section-3.1,
Messages sent over UDP must be sent separately.

> Each syslog UDP datagram MUST contain only one syslog message
@andrzej-stencel
Copy link
Member Author

I have changed the implementation to only batch messages when using TCP. As correctly pointed out by @kkujawa-sumo (thank you!), when sending over UDP, each message must be sent in a separate request: https://datatracker.ietf.org/doc/html/rfc5426#section-3.1

Each syslog UDP datagram MUST contain only one syslog message

@andrzej-stencel
Copy link
Member Author

@songy23 anything missing from marking it as ready to merge? Not sure if this is the way to signal to maintainers that this can be merged.

@songy23 songy23 added the ready to merge Code review completed; ready to merge by maintainers label Oct 30, 2023
@songy23
Copy link
Member

songy23 commented Oct 30, 2023

Added the label, cc @open-telemetry/collector-contrib-maintainer please merge 🙏

@djaglowski djaglowski merged commit f2ec166 into open-telemetry:main Oct 30, 2023
87 checks passed
@github-actions github-actions bot added this to the next release milestone Oct 30, 2023
@andrzej-stencel andrzej-stencel deleted the syslog-exporter-performance branch October 30, 2023 20:01
jmsnll pushed a commit to jmsnll/opentelemetry-collector-contrib that referenced this pull request Nov 12, 2023
**Description:**

This changes the behavior of the Syslog exporter to send each batch of
Syslog messages in a single request (with messages separated by
newlines), instead of sending each message in a separate request and
closing the connection after each message.

The batching only happens when using TCP. For UDP, each syslog message
is still sent in a separate request, as defined by [the
spec](https://datatracker.ietf.org/doc/html/rfc5426#section-3.1).

This also significantly refactors (and hopefully simplifies) the
exporter's code, extracting the code that formats the syslog messages
from the `sender` type into separate `formatter` types. Hopefully this
will make the development of this component easier.

**Link to tracking Issue:**

-
open-telemetry#21244

**Testing:**

The unit tests have been updated to reflect the refactored codebase. The
integration tests introduced in
open-telemetry#27464
are unchanged, as the format of the output messages hasn't changed.

**Documentation:**

No documentation updates.
RoryCrispin pushed a commit to ClickHouse/opentelemetry-collector-contrib that referenced this pull request Nov 24, 2023
**Description:**

This changes the behavior of the Syslog exporter to send each batch of
Syslog messages in a single request (with messages separated by
newlines), instead of sending each message in a separate request and
closing the connection after each message.

The batching only happens when using TCP. For UDP, each syslog message
is still sent in a separate request, as defined by [the
spec](https://datatracker.ietf.org/doc/html/rfc5426#section-3.1).

This also significantly refactors (and hopefully simplifies) the
exporter's code, extracting the code that formats the syslog messages
from the `sender` type into separate `formatter` types. Hopefully this
will make the development of this component easier.

**Link to tracking Issue:**

-
open-telemetry#21244

**Testing:**

The unit tests have been updated to reflect the refactored codebase. The
integration tests introduced in
open-telemetry#27464
are unchanged, as the format of the output messages hasn't changed.

**Documentation:**

No documentation updates.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
exporter/syslog ready to merge Code review completed; ready to merge by maintainers
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants