Skip to content

client not using proxy - grpc #118

@karel-rehor

Description

@karel-rehor

Specifications

  • Client Version: 1.11 dev [unreleased]
  • InfluxDB Version: cloud - [TODO] check also clustered
  • Platform: client ubunt 22.04 + Python 3.12

Using an envoy proxy server between client and server query requests are not showing up in the proxy log. They seem to succeed regardless. This implies that the proxy settings are being ignored. See EAR 5702

Regarding behavior with clustered a related issue is #117

Code sample to reproduce problem

from build.lib.influxdb_client_3 import InfluxDBClient3
import time
import logging
import http.client

def main() -> None:
    print("main()")
    http.client.HTTPConnection.debuglevel = 1
    logging.basicConfig()
    logging.getLogger().setLevel(logging.DEBUG)
    requests_log = logging.getLogger("request.packages.urllib3")
    requests_log.setLevel(logging.DEBUG)
    requests_log.propagate = True
    client = InfluxDBClient3(
        # host="http://localhost:3000",
        host="https://us-east-1-1.aws.cloud2.influxdata.com",
        token="******",
        org="Bonitoo",
        database="Ephemera",
        proxy="http://localhost:10000",
        # proxy="http://localhost:80",
        debug=True
    )

    now = time.time_ns()

    lp = f'drone,location=harfa,id=A16E22 speed=18.7,alt=97.6,shutter=7 {now}'

    print("Writing Data")
    client.write(lp)
    print(f"Wrote {lp}")

    table = client.query(
        query="SELECT * FROM drone WHERE time >= now() - interval '1 hour'")

    print(table.to_pandas())


if __name__ == "__main__":
    main()

Expected behavior

That the proxy settings be used for both writes and queries. Expect to see in the proxy log a record like the following.

envoy-1  | [2025-02-07T13:10:15.727Z] "CONNECT - HTTP/1.1" 200 DC 418 255 2 - "-" "grpc-httpcli/0.0" "8739665c-96f2-4f8f-9961-5618291c0d24" "192.168.88.82:50051" "192.168.88.82:50051"

Also that proxy settings can be set through environment variables, a configuration file and directly in the client code.

Actual behavior

When inspecting the proxy logs, it appears the write API is using the proxy, however the query API request using Flight > GRPC are not showing up.

Example

envoy-1  | [2025-02-07 09:47:14.922][22][debug][http] [source/common/http/conn_manager_impl.cc:1135] [Tags: "ConnectionId":"11","StreamId":"17761144465323234730"] request headers complete (end_stream=false):
envoy-1  | ':authority', 'us-east-1-1.aws.cloud2.influxdata.com:443'
envoy-1  | ':method', 'CONNECT'
envoy-1  | 
envoy-1  | [2025-02-07 09:47:14.922][22][debug][connection] [./source/common/network/connection_impl.h:98] [Tags: "ConnectionId":"11"] current connecting state: false
envoy-1  | [2025-02-07 09:47:14.922][22][debug][router] [source/common/router/router.cc:525] [Tags: "ConnectionId":"11","StreamId":"17761144465323234730"] cluster 'influxdb_cluster' match for URL ''
envoy-1  | [2025-02-07 09:47:14.922][22][debug][misc] [source/common/upstream/cluster_manager_impl.cc:2295] Allocating TCP conn pool
envoy-1  | [2025-02-07 09:47:14.922][22][debug][router] [source/common/router/router.cc:750] [Tags: "ConnectionId":"11","StreamId":"17761144465323234730"] router decoding headers:
envoy-1  | ':authority', 'us-east-1-1.aws.cloud2.influxdata.com:443'
envoy-1  | ':method', 'CONNECT'
envoy-1  | ':scheme', 'http'
envoy-1  | 'x-forwarded-proto', 'http'
envoy-1  | 'x-request-id', '963c4250-2187-4be5-b7c4-182505b40b06'
envoy-1  | 'x-envoy-expected-rq-timeout-ms', '15000'
...
envoy-1  | [2025-02-07T09:47:14.922Z] "CONNECT - HTTP/1.1" 200 DC 1089 3644 1088 - "-" "-" "963c4250-2187-4be5-b7c4-182505b40b06" "us-east-1-1.aws.cloud2.influxdata.com:443" "34.196.233.7:443"
...

Though the query follows, it does not appear in the log.

Additional info

No response

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions