Skip to content

HAProxy Configuration

HAProxy Configuration in Data Aggregator Guide.

5 min read Updated SS MR

HAProxy Configuration#

Follow the steps below to configure HAProxy: 

1. Navigate to the directory where the old HAProxy is present. 

2. Create a new HAProxy-OTEL folder. 

3. Place the new haproxy.cfg file. 

4. Modify the parameters below: 

For example:

global
  log         127.0.0.1 local0
  pidfile     /tmp/haproxy.pid
  maxconn     32000
  tune.ssl.default-dh-param 2048
  ssl-default-server-options no-sslv3 no-tlsv10 no-tlsv11
  ssl-default-bind-options no-sslv3 no-tlsv10 no-tlsv11
  daemon
  nbthread    8       # Increase the thread count if required. min-1 max-8
  cpu-map    auto:1/1-8 0-7 # Change the value based on thread count set above. E.g. For value 8 config should be auto:1/1-8 0-7
  tune.bufsize 32768
    tune.maxaccept 10000
  group               haproxy
  user                haproxy
  localpeer           otelloadbalancer1

defaults
   mode                    tcp
  option                  tcplog
  option                  dontlognull
  log                     global
  retries                 3
  timeout http-request    10s
  timeout queue           1m
  timeout connect         5s
  timeout client         90s
  timeout server         90s
  timeout tunnel         10m

listen stats # Define a listen section called "stats"
      bind :9797 ssl crt /etc/ssl/certs/haproxy.pem
      mode http
      stats enable  # Enable stats page
      stats hide-version  # Hide HAProxy version
      stats realm Haproxy\ Statistics  # Title text for popup window
      stats uri /haproxy_stats_otel  # Stats URI
      stats auth admin:<password>  # Authentication credentials

frontend opentelemetry_frontend
     bind :4319 #Provide the old OTEL LB port number.
     mode tcp
     default_backend otel_backend_http

backend otel_backend_http
    balance leastconn
    mode tcp
    option tcp-check
     server otel-collector-lb1 192.0.2.47:4321 check inter 3s rise 2 fall 3 maxconn 16000 #Provide the new port number to OTEL LB.
     server otel-collector-lb2 192.0.2.48:4321 check inter 3s rise 2 fall 3 maxconn 16000 #Provide the new port number to OTEL LB.

OTEL LB Configuration#

Ensure both/all the OTEL LB config files are as follows:

Note:

  • If multiple OTEL LBs are running on the same server, then different port numbers must be configured for each.
  • If the OTEL LBs are deployed on different servers, the same port number can be used.

For example:

extensions:
  zpages:
    endpoint: :55681
  health_check:
    endpoint: :13134
  file_storage:
    directory: /var/lib/otelcol/storage
    timeout: 1s
    compaction:
      directory: /tmp
      on_start: true
      on_rebound: true
      rebound_needed_threshold_mib: 100
      rebound_trigger_threshold_mib: 10
      check_interval: 5s

receivers:
  jaeger:
    protocols:
      grpc:
        endpoint: 0.0.0.0:14251
        max_recv_msg_size_mib: 128
otlp:
  protocols:
    grpc:
      endpoint: 0.0.0.0:4321
      max_recv_msg_size_mib: 128

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 82
    spike_limit_percentage: 12
  probabilistic_sampler:
    sampling_percentage: 50
  batch:
    send_batch_size: 2000
    timeout: 100ms

exporters:
  debug:
    verbosity: basic
  loadbalancing:
    protocol:
      otlp:
        timeout: 5s
        tls:
          insecure: true 
        sending_queue:
          enabled: true
          num_consumers: 48
          queue_size: 1000
          storage: file_storage
    routing_key: traceID
    resolver:
static:
hostnames:
- 192.0.2.47:4320
- 192.0.2.48:4320

service:
  extensions: [ zpages, health_check, file_storage ]
  telemetry:
    logs:
      level: info
    metrics:
      level: normal
      address: :8889
   pipelines:
     traces:
       receivers:
         - jaeger
         - otlp
       processors: [ memory_limiter, batch ]
       exporters: [ debug, loadbalancing ]

OTEL Collector Configuration#

Ensure both/all the OTEL Collector config files are as follows:

Note:

  • If multiple OTEL LBs are running on the same server, then different port numbers must be configured for each.
  • If the OTEL LBs are deployed on different servers, the same port number can be used.
extensions:
  zpages:
    endpoint: :55680
  health_check:
    endpoint: :13133
file_storage:
  directory: /var/lib/otelcol/storage
  timeout: 1s
  compaction:
    directory: /tmp
    on_start: true
    on_rebound: true
    rebound_needed_threshold_mib: 100
    rebound_trigger_threshold_mib: 10
    check_interval: 5s

receivers:
  otlp:
    protocols:
      grpc:
        endpoint: 0.0.0.0:4320
        max_recv_msg_size_mib: 128

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 82
    spike_limit_percentage: 12
  filter/http_server_client:
    error_mode: ignore
    traces:
      span:
        - attributes["http.method"] == nil
  filter/drop-noisy-service:
    error_mode: ignore
    traces:
      span:
        - |
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "kafka-processor" or
          resource.attributes["service.name"] == "serviceauditprocessor-PROD" or
          resource.attributes["service.name"] == "serviceauditprocessor-PROD-DR" or
          resource.attributes["service.name"] == "serviceauditprocessor-PROD" or
          resource.attributes["service.name"] == "serviceauditprocessor-PROD-DRINB" or
          resource.attributes["service.name"] == "serviceauditprocessor-PROD-DRMB" or
          resource.attributes["service.name"] == "serviceauditprocessor-PROD-DRFOS" or
          resource.attributes["service.name"] == "serviceauditprocessor-PRODFOS" or
          resource.attributes["service.name"] == "transauditprocessor-PROD" or
          resource.attributes["service.name"] == "transauditprocessor-PROD-DR" or
          resource.attributes["service.name"] == "transauditprocessor-PROD" or
          resource.attributes["service.name"] == "transauditprocessor-PRODMB" or
          resource.attributes["service.name"] == "transauditprocessor-PROD-DRINB" or
          resource.attributes["service.name"] == "transauditprocessor-PROD-DRMB" or
          resource.attributes["service.name"] == "transauditprocessor-PROD-DRFOS" or
          resource.attributes["service.name"] == "transauditprocessor-PRODFOS" or
          resource.attributes["service.name"] == "communicationhubprocessor-PROD" or
          resource.attributes["service.name"] == "communicationhubprocessor-PROD-DR" or
          resource.attributes["service.name"] == "communicationhubprocessor-PRODMB" or
          resource.attributes["service.name"] == "communicationhubprocessor-PROD-DRINB" or
          resource.attributes["service.name"] == "communicationhubprocessor-PROD-DRFOS" or
          resource.attributes["service.name"] == "communicationhubprocessor-PROD" or
          resource.attributes["service.name"] == "communicationhubprocessor-PRODFOS" or
          resource.attributes["service.name"] == "npsbatchms-PROD-DR" or
          resource.attributes["service.name"] == "npsbatchms-PROD" or
          resource.attributes["service.name"] == "npsbatchms-PROD" or
          resource.attributes["service.name"] == "npsbatchms-PRODMB" or
          resource.attributes["service.name"] == "npsbatchms-PRODFOS" or
          resource.attributes["service.name"] == "npsbatchms-PROD-DRINB" or
          resource.attributes["service.name"] == "npsbatchms-PROD-DRFOS" or
          resource.attributes["service.name"] == "npsbatchms-PROD-DRMB" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PROD-DR" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PROD" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PROD" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PRODMB" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PRODFOS" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PROD-DRINB" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PROD-DRFOS" or
          resource.attributes["service.name"] == "feedbackendstatebatchms-PROD-DRMB" or
          resource.attributes["service.name"] == "bwfhouskeepingms-PROD" or
          resource.attributes["service.name"] == "bwfhouskeepingms-PROD-DR" or
          resource.attributes["service.name"] == "bwfhouskeepingms-PROD" or
          resource.attributes["service.name"] == "bwfhouskeepingms-PRODFOS" or
          resource.attributes["service.name"] == "bwfhouskeepingms-PRODMB" or
          resource.attributes["service.name"] == "batch-a-PROD-DR" or
          resource.attributes["service.name"] == "batch-a-PROD" or
          resource.attributes["service.name"] == "batch-a-PROD" or
          resource.attributes["service.name"] == "batch-a-PRODMB" or
          resource.attributes["service.name"] == "batch-a-PROD-DRINB" or
          resource.attributes["service.name"] == "batch-a-PRODFOS" or
          resource.attributes["service.name"] == "batch-a-PROD-DRMB" or
          resource.attributes["service.name"] == "batch-a-PROD-DRFOS" or
          resource.attributes["service.name"] == "ccsbatch-PRODCCS" or
          resource.attributes["service.name"] == "ccsbatch-PROD-DRS" or
          resource.attributes["service.name"] == "referralbatchms-PROD" or
          resource.attributes["service.name"] == "referralbatchms-PROD-DR" or
          resource.attributes["service.name"] == "referralbatchms-PROD" or
          resource.attributes["service.name"] == "referralbatchms-PRODMB" or
          resource.attributes["service.name"] == "referralbatchms-PRODFOS" or
          resource.attributes["service.name"] == "referralbatchms-PROD-DRINB" or
          resource.attributes["service.name"] == "referralbatchms-PROD-DRMB" or
          resource.attributes["service.name"] == "referralbatchms-PROD-DRFOS" or
          resource.attributes["service.name"] == "ccbatchms-PROD" or
          resource.attributes["service.name"] == "ccbatchms-PROD-DR" or
          resource.attributes["service.name"] == "ccbatchms-PROD" or
          resource.attributes["service.name"] == "ccbatchms-PRODMB" or
          resource.attributes["service.name"] == "ccbatchms-PROD-DRFOS" or
          resource.attributes["service.name"] == "ccbatchms-PRODFOS" or
          resource.attributes["service.name"] == "ccbatchms-PROD-DRMB" or
          resource.attributes["service.name"] == "ccbatchms-PROD-DRINB" or
          resource.attributes["service.name"] == "batch-b-PROD" or
          resource.attributes["service.name"] == "batch-b-PROD-DR" or
          resource.attributes["service.name"] == "batch-b-PRODMB" or
          resource.attributes["service.name"] == "batch-b-PRODFOS" or
          resource.attributes["service.name"] == "batch-b-PROD" or
          resource.attributes["service.name"] == "batch-b-PROD-DRINB" or
          resource.attributes["service.name"] == "batch-b-PROD-DRMB" or
          resource.attributes["service.name"] == "batch-b-PROD-DRFOS" or
          resource.attributes["service.name"] == "service-a-PROD" or
          resource.attributes["service.name"] == "service-a-PROD-DR" or
          resource.attributes["service.name"] == "service-a-PROD" or
          resource.attributes["service.name"] == "service-a-PRODMB" or
          resource.attributes["service.name"] == "service-a-PRODFOS" or
          resource.attributes["service.name"] == "service-a-PROD-DRINB" or
          resource.attributes["service.name"] == "service-a-PROD-DRMB" or
          resource.attributes["service.name"] == "service-a-PROD-DRFOS" or
          resource.attributes["service.name"] == "beneficiarymgmntmsv2-PRODFOS" or
          resource.attributes["service.name"] == "beneficiarymgmntmsv2-PRODMB" or
          resource.attributes["service.name"] == "beneficiarymgmntmsv2-PROD" or
          resource.attributes["service.name"] == "beneficiarymgmntmsv2-PROD-DR" or
          resource.attributes["service.name"] == "beneficiarymgmntmsv2-PROD" or
          resource.attributes["service.name"] == "beneficiarymgmntmsv2-PROD-DRMB"
resource/remove_process_attributes:
  attributes:
    - key: host.arch
      action: delete
    - key: host.name
      action: delete
    - key: os.description
      action: delete
    - key: os.type
      action: delete
    - key: process.executable.path
      action: delete
    - key: process.pid
      action: delete
    - key: process.runtime.description
      action: delete
    - key: process.runtime.name
      action: delete
    - key: process.runtime.version
      action: delete
    - key: telemetry.auto.version
      action: delete
    - key: telemetry.sdk.language
      action: delete
    - key: telemetry.sdk.name
      action: delete
    - key: telemetry.sdk.version
      action: delete
batch:
  send_batch_size: 1000
  timeout: 100ms
batch/rmq:
  send_batch_size: 1000
  timeout: 100ms

exporters:
  debug:
    verbosity: basic

  rabbitmq/for_agg:
    connection:
      endpoint: amqps://192.0.2.47:5673
      auth:
        plain:
          username: guest
          password: guest
        tls:
          ca_file: /opt/heal-opentelemetry-collector/root-ca.pem
    routing:
      routing_key: otlp_spans_137
    retry_on_failure:
      enabled: true

   heal_opensearch/trace:
     endpoints: [ https://192.0.2.49:9250, https://192.0.2.50:9250, https://192.0.2.51:9250 ]
     user: healadmin
     password: <base64-password>
     tls:
       ca_file: /opt/heal-opentelemetry-collector/root-ca.pem
       insecure_skip_verify: false
     retry:
       enabled: true
     sending_queue:
       enabled: true
       num_consumers: 48
       queue_size: 2000
       storage: file_storage
     num_workers: 24
     traces_index_date_layout: hour
     flush:
       bytes: 5242880
       interval: 1s
     context_deadline_timeout: 150s

service:
  extensions: [zpages, health_check, file_storage]
  telemetry:
    logs:
      level: info
    metrics:
      level: normal
      address: :8888
  pipelines:
    traces/all:
      receivers: [ otlp ]
      processors: [ memory_limiter, resource/remove_process_attributes, batch ]
      exporters: [ heal_opensearch/trace ]
    traces/rmq_for_agg:
      receivers: [ otlp ]
      processors: [ memory_limiter, resource/remove_process_attributes, filter/http_server_client, batch/rmq ]
      exporters: [ debug, rabbitmq/for_agg ]