envoyproxy/envoy

HTTP Tap - Streamed trace segments output does not contain headers added by Envoy

Open

#9.325 aberto em 12 de dez. de 2019

Ver no GitHub
 (3 comments) (0 reactions) (0 assignees)C++ (5.373 forks)batch import
area/tapdesign proposalhelp wanted

Métricas do repositório

Stars
 (27.997 stars)
Métricas de merge de PR
 (Mesclagem média 8d) (378 fundiu PRs em 30d)

Description

Title: HTTP Tap - Segmented trace output does not contain headers added by Envoy

Description: Using the Tap feature the fully buffered trace and the streamed trace segments output formats differ with regard to the headers added by Envoy. The streamed trace segments output does not contain the headers added at virtual host, global route and route level while the buffered trace output contains all those. My expectation would be that tap output contains the same HTTP headers for both output format.

Using Envoy version: "44f8c365a1f1798f0af776f6aa64279dc68f5666/1.12.1/Clean/RELEASE/BoringSSL"

Config: The corresponding HTTP config:

- name: envoy.http_connection_manager          
        config:
          codec_type: AUTO
          stat_prefix: ingress_http        
          route_config:
            name: remote_api            
            virtual_hosts:
            - name: apiq
              domains:
              - "*"
              request_headers_to_add:
              - header:
                  key: "x-req-hdr-add-vh-level"
                  value: "req-vh"              
              routes:
              - match:
                  prefix: "/"
                route:
                  cluster: someserver
                request_headers_to_add: 
                  - header:
                      key: "x-req-hdr-add-rt-level"
                      value: "req-rt"               
            request_headers_to_add: 
              - header:
                  key: "x-req-hdr-add-global-rt-level"
                  value: "req-global-rt" 
          http_filters:
          - name: envoy.lua
            config:
              inline_code:  |
                  function envoy_on_request(request_handle)
                    request_handle:headers():add("x-req-hdr-add-lua", "req-lua")
                  end                                                   
          - name: envoy.filters.http.tap
            config:
              common_config:
                admin_config:
                  config_id: test_config_id                        
           - name: envoy.router   

Tap config used for fully buffered trace output:

config_id: test_config_id
tap_config:
  match_config:
    any_match: true
  output_config:
    sinks:
      - streaming_admin: {}`

Tap config used for streamed trace segments output:

config_id: test_config_id
tap_config:
  match_config:
    any_match: true
  output_config:
    streaming: true
    sinks:
      - streaming_admin: {}`

Output: Fully buffered trace output.

{
 "http_buffered_trace": {
  "request": {
   "headers": [
    {
     "key": ":authority",
     "value": "10.0.2.15:10000"
    },
    {
     "key": ":path",
     "value": "/delay"
    },
    {
     "key": ":method",
     "value": "GET"
    },
    {
     "key": ":scheme",
     "value": "http"
    },
    {
     "key": "user-agent",
     "value": "curl/7.58.0"
    },
    {
     "key": "accept",
     "value": "*/*"
    },
    {
     "key": "x-forwarded-proto",
     "value": "http"
    },
    {
     "key": "x-request-id",
     "value": "462b17b5-7222-4a69-b608-cab90a591698"
    },
    {
     "key": "x-req-hdr-add-lua",
     "value": "req-lua"
    },
    {
     "key": "x-envoy-expected-rq-timeout-ms",
     "value": "15000"
    },
    {
     "key": "x-req-hdr-add-rt-level",
     "value": "req-rt"
    },
    {
     "key": "x-req-hdr-add-vh-level",
     "value": "req-vh"
    },
    {
     "key": "x-req-hdr-add-global-rt-level",
     "value": "req-global-rt"
    }
   ],
   "trailers": []
  },

Streamed trace segments output:

{
 "http_streamed_trace_segment": {
  "trace_id": "15955110079683032660",
  "request_headers": {
   "headers": [
    {
     "key": ":authority",
     "value": "10.0.2.15:10000"
    },
    {
     "key": ":path",
     "value": "/delay"
    },
    {
     "key": ":method",
     "value": "GET"
    },
    {
     "key": "user-agent",
     "value": "curl/7.58.0"
    },
    {
     "key": "accept",
     "value": "*/*"
    },
    {
     "key": "x-forwarded-proto",
     "value": "http"
    },
    {
     "key": "x-request-id",
     "value": "e0f0d2c0-e20e-4ad9-8799-e3ed98dbf59a"
    },
    {
     "key": "x-req-hdr-add-lua",
     "value": "req-lua"
    }
   ]
  }
 }
}

Guia do colaborador