Standalone test configuration (sa/)
=====================================

The 'sa' test is a standalone single-instance configuration that
exercises most HAProxy filter events with spans, attributes, events,
links, baggage, status, metrics, logs and groups.  It represents the
most comprehensive single-instance configuration and is used as the
worst-case scenario in speed tests.

Six events are not covered by this configuration: on-backend-set,
on-http-headers-request, on-http-end-request, on-http-headers-response,
on-http-end-response and on-http-reply.  The 'full' configuration
extends 'sa' with those events.


Files
------

  sa/otel.cfg    OTel filter configuration (scopes, groups, instruments)
  sa/haproxy.cfg HAProxy frontend/backend configuration
  sa/otel.yml    Exporter, processor, reader and provider definitions
  run-sa.sh      Convenience script to launch HAProxy with this config


Events
-------

  T = Trace (span)    M = Metric (instrument)    L = Log (log-record)

  Stream lifecycle events:

    Event                    Scope                       T  M  L
    ---------------------------------------------------------------
    on-stream-start          on_stream_start             x  x  x
    on-stream-stop           on_stream_stop              -  -  -
    on-idle-timeout          on_idle_timeout              x  x  x

  Request analyzer events:

    Event                              Scope                          T  M  L
    --------------------------------------------------------------------------
    on-client-session-start            client_session_start           x  -  -
    on-frontend-tcp-request            frontend_tcp_request           x  -  -
    on-http-wait-request               http_wait_request              x  -  -
    on-http-body-request               http_body_request              x  -  -
    on-frontend-http-request           frontend_http_request          x  x  x
    on-switching-rules-request         switching_rules_request        x  -  -
    on-backend-tcp-request             backend_tcp_request            x  -  -
    on-backend-http-request            backend_http_request           x  -  -
    on-process-server-rules-request    process_server_rules_request   x  -  -
    on-http-process-request            http_process_request           x  -  -
    on-tcp-rdp-cookie-request          tcp_rdp_cookie_request         x  -  -
    on-process-sticking-rules-request  process_sticking_rules_request x  -  -
    on-client-session-end              client_session_end             -  x  -
    on-server-unavailable              server_unavailable             -  -  -

  Response analyzer events:

    Event                              Scope                          T  M  L
    --------------------------------------------------------------------------
    on-server-session-start            server_session_start           x  -  -
    on-tcp-response                    tcp_response                   x  -  -
    on-http-wait-response              http_wait_response             x  -  -
    on-process-store-rules-response    process_store_rules_response   x  -  -
    on-http-response                   http_response                  x  x  -
    on-server-session-end              server_session_end             -  -  -

  Additionally, the http_response-error scope fires conditionally on the
  on-http-response event when the response status is outside the 100-399
  range, setting an error status on the "HTTP response" span.

  The http_response_group (http_response_1, http_response_2) and
  http_after_response_group (http_after_response) are invoked via
  http-response and http-after-response directives in haproxy.cfg.


Instruments
------------

  Instrument name            Type       Defined in              Updated in
  --------------------------------------------------------------------------
  haproxy.sessions.active    udcnt_int  on_stream_start         client_session_end
  haproxy.fe.connections     gauge_int  on_stream_start         http_response
  idle.count                 cnt_int    on_idle_timeout         on_idle_timeout
  haproxy.http.requests      cnt_int    frontend_http_request   http_response
  haproxy.http.latency       hist_int   frontend_http_request   frontend_http_request,
                                                                http_response


Span hierarchy
---------------

  Request path:

    "HAProxy session" (root)
     +-- "Client session"
          +-- "Frontend TCP request"
               +-- "HTTP wait request"
                    +-- "HTTP body request"
                         +-- "Frontend HTTP request"  [link: "HAProxy session"]
                              +-- "Switching rules request"
                                   +-- "Backend TCP request"
                                        +-- "Backend HTTP request"
                                             +-- "Process server rules request"
                                                  +-- "HTTP process request"
                                                       +-- "TCP RDP cookie request"
                                                            +-- "Process sticking rules request"

  Response path:

    "HAProxy session" (root)
     +-- "Server session"  [link: "HAProxy session", "Client session"]
          +-- "TCP response"
               +-- "HTTP wait response"
                    +-- "Process store rules response"
                         +-- "HTTP response"

  Auxiliary spans:

    "HAProxy session"
     +-- "heartbeat"              (on-idle-timeout, periodic)
     +-- "HAProxy response"       (http_after_response_group, on error)


Running the test
-----------------

From the test/ directory:

  % ./run-sa.sh [/path/to/haproxy] [pidfile]

If no arguments are given, the script looks for the haproxy binary three
directories up from the current working directory.  The backend origin
server must be running on 127.0.0.1:8000.
