github.com/anycable/anycable-go@v1.5.1/docs/tracing.md (about)

     1  # AnyCable-Go Tracing
     2  
     3  AnyCable-Go assigns a random unique `sid` (_session ID_) or use the one provided in the `X-Request-ID` HTTP header
     4  to each websocket connection and passes it with requests to RPC service. This identifier is also
     5  available in logs and you can use it to trace a request's pathway through the whole Load Balancer -> WS Server -> RPC stack.
     6  
     7  Logs example:
     8  
     9  ```sh
    10  D 2019-04-25T18:41:07.172Z context=node sid=FQQS_IltswlTJK60ncf9Cm Incoming message: &{subscribe {"channel":"PresenceChannel"} }
    11  D 2019-04-25T18:41:08.074Z context=pubsub Incoming pubsub message from Redis: {"stream":"presence:Z2lkOi8vbWFuYWdlYmFjL1NjaG9vbC8xMDAwMjI3Mw","data":"{\"type\":\"presence\",\"event\":\"user-presence-changed\",\"user_id\":1,\"status\":\"online\"}"}
    12  ```
    13  
    14  ## Using with Heroku
    15  
    16  Heroku assigns `X-Request-ID` [automatically at the router level](https://devcenter.heroku.com/articles/http-request-id).
    17  
    18  ## Using with NGINX
    19  
    20  If you use AnyCable-Go behind NGINX server, you can assign request id with the provided configuration example:
    21  
    22  ```nginx
    23  # Сonfiguration is shortened for the sake of brevity
    24  
    25  log_format trace '$remote_addr - $remote_user [$time_local] "$request" '
    26                   '$status $body_bytes_sent "$http_referer" "$http_user_agent" '
    27                   '"$http_x_forwarded_for" $request_id'; # `trace` logger
    28  
    29  server {
    30      add_header X-Request-ID $request_id; # Return `X-Request-ID` to client
    31  
    32      location /cable {
    33          proxy_set_header X-Request-ID $request_id; # Pass X-Request-ID` to AnyCable-GO server
    34          access_log /var/log/nginx/access_trace.log trace; # Use `trace` log
    35      }
    36  }
    37  ```