open-telemetry / opentelemetry-collector-contrib

Contrib repository for the OpenTelemetry Collector
https://opentelemetry.io
Apache License 2.0
3.08k stars 2.38k forks source link

Minimal viable statsdreceiver not working #34067

Closed paulkiernan closed 4 months ago

paulkiernan commented 4 months ago

Component(s)

receiver/statsd

What happened?

Description

I'm testing setting up a pipeline to receive DogStatsD metrics emitted from the third-party service we host. When setting up a toy example of a otel-collector with a statsd pipeline defined I'm afraid I haven't been able to print statsd metrics received via the debug or file exporters.

Steps to Reproduce

Create a config file with the contents:

receivers:
  statsd:
    endpoint: "0.0.0.0:8125"
    aggregation_interval: 10s

exporters:
  debug:
    verbosity: normal
  file:
    path: /tmp/output/test.json

service:
  telemetry:
    logs:
      level: "DEBUG"
  pipelines:
    metrics:
     receivers:
       - statsd
     exporters:
       - debug
       - file

Run with docker:

docker run \
    -it \
    -v ./test2.yaml:/tmp/config.yaml \. # where test2.yaml is the name of the config from above
    -v ./output:/tmp/output \
    -p 8125:8125/udp \
    -p 8888:8888 \
    otel/opentelemetry-collector-contrib:0.104.0 --config=file:/tmp/config.yaml

In another window, publish message via:

echo "test.metric:42|c|#myKey:myVal" | nc -u -6 localhost 8125;

Expected Result

netcat command should exit and a reference to the test.metric should display in the collector logs via the debug exporter, and in the output/test.json.

Actual Result

netcat hangs and nothing shows up in either exporter.

Collector version

0.104.0

Environment information

Environment

OS: Mac osx 14.5 (sonoma) Docker:

docker version                                                                                                                                                                                                                                                                             130 ↵
Client:
 Cloud integration: v1.0.35+desktop.13
 Version:           26.0.0
 API version:       1.45
 Go version:        go1.21.8
 Git commit:        2ae903e
 Built:             Wed Mar 20 15:14:46 2024
 OS/Arch:           darwin/arm64
 Context:           desktop-linux

Server: Docker Desktop 4.29.0 (145265)
 Engine:
  Version:          26.0.0
  API version:      1.45 (minimum version 1.24)
  Go version:       go1.21.8
  Git commit:       8b79278
  Built:            Wed Mar 20 15:18:02 2024
  OS/Arch:          linux/arm64
  Experimental:     false
 containerd:
  Version:          1.6.28
  GitCommit:        ae07eda36dd25f8a1b98dfbf587313b99c0190bb
 runc:
  Version:          1.1.12
  GitCommit:        v1.1.12-0-g51d5e94
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

OpenTelemetry Collector configuration

receivers:
  statsd:
    endpoint: "0.0.0.0:8125"
    aggregation_interval: 10s

exporters:
  debug:
    verbosity: normal
  file:
    path: /tmp/output/test.json

service:
  telemetry:
    logs:
      level: "DEBUG"
  pipelines:
    metrics:
     receivers:
       - statsd
     exporters:
       - debug
       - file

Log output

2024-07-13T02:51:56.395Z        info    service@v0.104.0/service.go:115 Setting up own telemetry...
2024-07-13T02:51:56.395Z        info    service@v0.104.0/telemetry.go:96        Serving metrics {"address": ":8888", "level": "Normal"}
2024-07-13T02:51:56.395Z        info    exporter@v0.104.0/exporter.go:280       Development component. May change in the future.        {"kind": "exporter", "data_type": "metrics", "name": "debug"}
2024-07-13T02:51:56.395Z        debug   exporter@v0.104.0/exporter.go:278       Alpha component. May change in the future.      {"kind": "exporter", "data_type": "metrics", "name": "file"}
2024-07-13T02:51:56.395Z        debug   receiver@v0.104.0/receiver.go:313       Beta component. May change in the future.       {"kind": "receiver", "name": "statsd", "data_type": "metrics"}
2024-07-13T02:51:56.396Z        info    service@v0.104.0/service.go:193 Starting otelcol-contrib...     {"Version": "0.104.0", "NumCPU": 8}
2024-07-13T02:51:56.396Z        info    extensions/extensions.go:34     Starting extensions...
2024-07-13T02:51:56.397Z        info    service@v0.104.0/service.go:219 Everything is ready. Begin running and processing data.

Additional context

No response

github-actions[bot] commented 4 months ago

Pinging code owners: