Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(catalog): Add ability to trace HTTP requests #1450

Closed
wants to merge 1 commit into from

Commits on May 10, 2024

  1. chore(catalog): Add ability to trace HTTP requests

    So that we can debug the requests and responses to the catalog server
    because `_FLOX_CATALOG_DUMP_RESPONSE_FILE` only gives us the translated
    response body. TBD whether we'd keep both.
    
    It looks like this in use:
    
        % FLOX_FEATURES_USE_CATALOG=true _FLOX_CATALOG_TRACE_HTTP=true just flox show hello -vvvvv
        …
        2024-05-10T15:12:26.036380Z TRACE reqwest::connect::verbose: 4e6242c9 write: b"GET /api/v1/catalog/packages/hello?page=0&pageSize=10 HTTP/1.1\r\naccept: application/json\r\nhost: flox-catalog.flox.dev\r\n\r\n"
        2024-05-10T15:12:26.036445Z DEBUG hyper::proto::h1::io: flushed 121 bytes
        2024-05-10T15:12:26.036472Z TRACE hyper::proto::h1::conn: flushed({role=client}): State { reading: Init, writing: KeepAlive, keep_alive: Busy }
        2024-05-10T15:12:26.599513Z TRACE hyper::proto::h1::conn: Conn::read_head
        2024-05-10T15:12:26.599745Z TRACE reqwest::connect::verbose: 4e6242c9 read: b"HTTP/1.1 200 OK\r\nServer: nginx\r\nDate: Fri, 10 May 2024 15:12:26 GMT\r\nContent-Type: application/json\r\nContent-Length: 461\r\nConnection: keep-alive\r\nVary: Accept-Encoding\r\n\r\n{\"items\":[{\"attr_path\":\"hello\",\"name\":\"hello-2.12.1\",\"pname\":\"hello\",\"version\":\"2.12.1\",\"outputs\":[{\"name\":\"out\",\"store_path\":\"/nix/store/f96mbgrwdfx6116arpm2bzjak21wmmw6-hello-2.12.1\"}],\"outputs_to_install\":[\"out\"],\"description\":\"A program that produces a familiar, friendly greeting\",\"license\":\"GPL-3.0-or-later\",\"rev\":\"25865a40d14b3f9cf19f19b924e2ab4069b09588\",\"rev_count\":621993,\"rev_date\":\"2024-05-05T10:51:47Z\",\"system\":\"aarch64-darwin\"}],\"total_count\":1}"
        …
    
    This is nice in the respect that it gives us the request too, there's
    minimal plumbing, and we don't have to figure out how to represent
    multiple request/response cycles.
    
    However the output is pretty noisy and requires some additional
    un-escaping such as:
    
        pbpaste | sed 's/\\"/"/g' | jq .
    dcarley committed May 10, 2024
    Configuration menu
    Copy the full SHA
    9ab0a69 View commit details
    Browse the repository at this point in the history