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

[receiver/statsd] log only non-EOF errors when reading payload received via TCP #33978

Merged
merged 2 commits into from
Jul 24, 2024

Conversation

bacherfl
Copy link
Contributor

@bacherfl bacherfl commented Jul 9, 2024

Description: This PR modifies the tcp server of the statsd receiver to log errors only if they are not an io.EOF, as this one is expected when the payload has been read completely.

Link to tracking Issue: #33951

Testing: The affected function has already been covered by existing tests. The only thing changed was whether to log the error or not.

Documentation: None required, as there have been no changes from user perspective

@github-actions github-actions bot added the receiver/statsd statsd related issues label Jul 9, 2024
@github-actions github-actions bot requested review from dmitryax and jmacd July 9, 2024 11:44
@bacherfl bacherfl marked this pull request as ready for review July 9, 2024 12:24
@bacherfl bacherfl requested a review from a team as a code owner July 9, 2024 12:24
@crobert-1
Copy link
Member

Have you been able to test to ensure the message is no longer logged for EOF?

@bacherfl
Copy link
Contributor Author

Have you been able to test to ensure the message is no longer logged for EOF?

Yes, I did some manual testing to verify the message is not logged.
For testing, I used the following config:

receivers:
  statsd:
    endpoint: 0.0.0.0:8125
    transport: tcp

processors:

exporters:
  debug:
    verbosity: detailed

service:
  telemetry:
    metrics:
      address: 0.0.0.0:8888
    logs:
      level: debug
  pipelines:
    metrics:
      receivers: [statsd]
      exporters: [debug]

And sent a metric using the following command:

echo "test.metric:42|c|#myKey:myVal" | nc -w 100000 -4 -v localhost 8125;

Which resulted in the following logs:

2024-07-09T13:58:53.188+0200    debug   [email protected]/receiver.go:313 Beta component. May change in the future.       {"kind": "receiver", "name": "statsd", "data_type": "metrics"}
2024-07-09T13:58:53.188+0200    info    extensions/extensions.go:34     Starting extensions...
2024-07-09T13:58:53.195+0200    info    [email protected]/service.go:219 Everything is ready. Begin running and processing data.
2024-07-09T13:58:53.195+0200    info    localhostgate/featuregate.go:63 The default endpoints for all servers in components have changed to use localhost instead of 0.0.0.0. Disable the feature gate to temporarily revert to the previous default.   {"feature gate ID": "component.UseLocalHostAsDefaultHost"}
2024-07-09T13:58:53.195+0200    info    zapgrpc/zapgrpc.go:176  [core] [Server #1 ListenSocket #2]ListenSocket created  {"grpc_log": true}
2024-07-09T13:59:53.196+0200    debug   [email protected]/parser.go:265     initial TransformContext        {"kind": "processor", "name": "transform", "pipeline": "metrics", "TransformContext": {}}
2024-07-09T13:59:53.196+0200    info    MetricsExporter {"kind": "exporter", "data_type": "metrics", "name": "debug", "resource metrics": 1, "metrics": 1, "data points": 1}
2024-07-09T13:59:53.196+0200    info    ResourceMetrics #0
Resource SchemaURL: 
ScopeMetrics #0
ScopeMetrics SchemaURL: 
InstrumentationScope otelcol/statsdreceiver 0.9.0
Metric #0
Descriptor:
     -> Name: test.metric
     -> Description: 
     -> Unit: 
     -> DataType: Sum
     -> IsMonotonic: false
     -> AggregationTemporality: Delta
NumberDataPoints #0
Data point attributes:
     -> myKey: Str(myVal)
StartTimestamp: 2024-07-09 11:58:53.195052 +0000 UTC
Timestamp: 2024-07-09 11:59:53.196102 +0000 UTC
Value: 42
        {"kind": "exporter", "data_type": "metrics", "name": "debug"}

Copy link
Contributor

This PR was marked stale due to lack of activity. It will be closed in 14 days.

@github-actions github-actions bot added the Stale label Jul 24, 2024
@mx-psi mx-psi merged commit 76c03ec into open-telemetry:main Jul 24, 2024
156 checks passed
@github-actions github-actions bot added this to the next release milestone Jul 24, 2024
@bacherfl bacherfl deleted the fix/33951/statsd-tcp branch July 24, 2024 09:14
abhishek-at-cloudwerx pushed a commit to Internal-Cloudwerx/opentelemetry-collector-contrib that referenced this pull request Aug 9, 2024
…ed via TCP (open-telemetry#33978)

**Description:** This PR modifies the tcp server of the statsd receiver
to log errors only if they are not an `io.EOF`, as this one is expected
when the payload has been read completely.

**Link to tracking Issue:** open-telemetry#33951

**Testing:** The affected function has already been covered by existing
tests. The only thing changed was whether to log the error or not.

**Documentation:** None required, as there have been no changes from
user perspective

---------

Signed-off-by: Florian Bacher <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
receiver/statsd statsd related issues Stale
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants