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

fix(instrumentation-redis): Take host and port used for connection #2072

Merged
merged 5 commits into from
Apr 29, 2024

Commits on Apr 17, 2024

  1. fix(instrumentation-redis): Take host and port used for connection

    The Redis client allows specifying connection options in several ways, with
    sensible defaults. The following all translate into `127.0.0.1:6379`:
    
    ```js
    createClient('redis://127.0.0.1:6379');
    createClient({ host: '127.0.0.1', port: NaN });
    createClient({})
    createClient()
    ```
    
    Redis somewhat normalises these separate options into its `options` member, and
    stores the properties it uses to connect to the server in
    `connection_options`. Examples of the difference between the two in the examples
    preceding (slightly redacted for ease of reading):
    
    ```js
    createClient('redis://127.0.0.1:6379');
    // options = { port: '6379', host: '127.0.0.1' }
    // connection_options = { port: 6379, host: '127.0.0.1', family: 4 }
    
    createClient({ host: '127.0.0.1', port: NaN });
    // options = { host: '127.0.0.1', port: NaN }
    // connection_options = { port: 6379, host: '127.0.0.1', family: 4 }
    
    createClient()
    // options = { host: undefined }
    // connection_options = { port: 6379, host: '127.0.0.1', family: 4 }
    ```
    
    The instrumentation before this commit looks at the `options` property, which
    contains caller-supplied values before they're fully normalised and smoothed
    over by Redis. This means that for these weird cases, the instrumentation would
    populate `NET_PEER_NAME` and `NET_PEER_PORT` with erroneous values.
    
    This commit has the instrumentation the values the Redis client uses to connect
    to the server, mirroring actual use.
    Zirak committed Apr 17, 2024
    Configuration menu
    Copy the full SHA
    f7c6f6f View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    498d968 View commit details
    Browse the repository at this point in the history

Commits on Apr 29, 2024

  1. Configuration menu
    Copy the full SHA
    b38921a View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    36ac09d View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    002c2fb View commit details
    Browse the repository at this point in the history