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/haproxy] fix reading more than 4096 bytes #32661

Merged
merged 1 commit into from
May 3, 2024

Conversation

atoulme
Copy link
Contributor

@atoulme atoulme commented Apr 24, 2024

Description:
This makes sure to read the whole data when interacting over the socket with haproxy.

Link to tracking Issue:
Fixes #32652

Testing:
Tested manually.

@atoulme
Copy link
Contributor Author

atoulme commented May 3, 2024

tested manually with the following:
haproxy.cfg:

global
  stats socket /tmp/admin.sock mode 660

frontend gr-prod-rw
    bind 0.0.0.0:3307     
    mode tcp
    option contstats
    option dontlognull
    option clitcpka
    default_backend servers

backend servers
    server server1 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server2 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server3 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup
    server server4 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server5 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server6 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server7 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server8 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server9 10.0.68.39:3307 check inter 10000 rise 1 fall 2 weight 50
    server server10 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server11 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup
    server server12 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server13 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup
    server server14 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server15 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup
    server server16 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server17 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup
    server server18 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server19 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup
    server server20 10.0.68.74:3307 check inter 10000 rise 1 fall 2 weight 50 backup
    server server21 10.0.68.20:3307 check inter 10000 rise 1 fall 2 weight 1 backup

otel.yaml

receivers:
  haproxy:
    endpoint: /tmp/admin.sock
    collection_interval: 10s

exporters:
  debug:
    verbosity: detailed

service:
  pipelines:
    metrics:
      receivers: [haproxy]
      exporters: [debug]

Verified that the output of the command is more than 4096 bytes:

echo 'show stat' | socat /tmp/admin.sock stdio | wc -c
    7091

Ran the collector and saw metrics come in.

@atoulme atoulme added the ready to merge Code review completed; ready to merge by maintainers label May 3, 2024
@codeboten codeboten merged commit a298c5a into open-telemetry:main May 3, 2024
177 checks passed
@github-actions github-actions bot added this to the next release milestone May 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ready to merge Code review completed; ready to merge by maintainers receiver/haproxy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

haproxy receiver fails to collect data via unix socket when "stat" data exceeds 4k
4 participants