Skip to content

feat(tracing): Add user data/transaction name to tracestate value #1177

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

Conversation

lobsterkatie
Copy link
Member

@lobsterkatie lobsterkatie commented Aug 30, 2021

This adds user data (specifically id and segment) and transaction name to the tracetate value.

Doing this has two known limitations, which, though we've discussed them, I'm adding here for posterity:

  1. Adding this data puts us over the character limit for tracestate values listed in the W3C spec (256 characters). For reference:

    Tracestate data:

    {
        "trace_id": "12312012123120121231201212312012",
        "environment": "dogpark",
        "release": "off.leash.park",
        "public_key": "dogsarebadatkeepingsecrets",
        "user": {"id": 12312013, "segment": "bigs"},
        "transaction": "/interactions/other-dogs/new-dog/"
    }
    

    tracestate with without either: 196 characters
    tracestate with user data: 256 characters
    tracestate with transaction name: 264 characters
    tracestate with both: 324 characters

  2. This data may change and/or get added to the scope after the tracestate value has been calculated, making it impossible to sample based on those attributes. This is especially a problem for transaction name, which in some frameworks isn't set to its final value until the transaction ends. This poses the added problem that the transaction name in its raw, un-finalized form may contain PII, because it is often the raw URL as opposed to the parameterized one (so, /users/maisey/tricks/ rather than /users/:username/tricks/). More work needs to be done to investigate whether the final transaction name can be set earlier in any/all of the frameworks where this poses a problem. (For instance, it is a known problem in our Express integration, but not yet clear if it is a problem in any Python frameworks.)

Copy link
Member

@untitaker untitaker left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SHIP IT

@lobsterkatie lobsterkatie merged commit 5f3f8be into kmclb-add-tracestate-header-handling Aug 30, 2021
@lobsterkatie lobsterkatie deleted the kmclb-add-transaction-name-to-tracestate branch August 30, 2021 15:55
lobsterkatie added a commit that referenced this pull request Sep 2, 2021
)

This adds user data (specifically `id` and `segment`) and transaction name to the `tracetate` value. 

Doing this has two known limitations, which, though we've discussed them, I'm adding here for posterity:

1) Adding this data puts us over the character limit for tracestate values [listed in the W3C spec](https://www.w3.org/TR/trace-context/#value) (256 characters). For reference:

    Tracestate data:

    ```
    {
        "trace_id": "12312012123120121231201212312012",
        "environment": "dogpark",
        "release": "off.leash.park",
        "public_key": "dogsarebadatkeepingsecrets",
        "user": {"id": 12312013, "segment": "bigs"},
        "transaction": "/interactions/other-dogs/new-dog/"
    }
    ```

    `tracestate`  with without either: 196 characters
    `tracestate` with user data: 256 characters
    `tracestate` with transaction name: 264 characters
    `tracestate` with both: 324 characters

2) This data may change and/or get added to the scope after the tracestate value has been calculated, making it impossible to sample based on those attributes. This is especially a problem for transaction name, which in some frameworks isn't set to its final value until the transaction ends. This poses the added problem that the transaction name in its raw, un-finalized form may contain PII, because it is often the raw URL as opposed to the parameterized one (so, `/users/maisey/tricks/` rather than `/users/:username/tricks/`). More work needs to be done to investigate whether the final transaction name can be set earlier in any/all of the frameworks where this poses a problem. (For instance, it is a known problem in our Express integration, but not yet clear if it is a problem in any Python frameworks.)
lobsterkatie added a commit that referenced this pull request Sep 13, 2021
)

This adds user data (specifically `id` and `segment`) and transaction name to the `tracetate` value. 

Doing this has two known limitations, which, though we've discussed them, I'm adding here for posterity:

1) Adding this data puts us over the character limit for tracestate values [listed in the W3C spec](https://www.w3.org/TR/trace-context/#value) (256 characters). For reference:

    Tracestate data:

    ```
    {
        "trace_id": "12312012123120121231201212312012",
        "environment": "dogpark",
        "release": "off.leash.park",
        "public_key": "dogsarebadatkeepingsecrets",
        "user": {"id": 12312013, "segment": "bigs"},
        "transaction": "/interactions/other-dogs/new-dog/"
    }
    ```

    `tracestate`  with without either: 196 characters
    `tracestate` with user data: 256 characters
    `tracestate` with transaction name: 264 characters
    `tracestate` with both: 324 characters

2) This data may change and/or get added to the scope after the tracestate value has been calculated, making it impossible to sample based on those attributes. This is especially a problem for transaction name, which in some frameworks isn't set to its final value until the transaction ends. This poses the added problem that the transaction name in its raw, un-finalized form may contain PII, because it is often the raw URL as opposed to the parameterized one (so, `/users/maisey/tricks/` rather than `/users/:username/tricks/`). More work needs to be done to investigate whether the final transaction name can be set earlier in any/all of the frameworks where this poses a problem. (For instance, it is a known problem in our Express integration, but not yet clear if it is a problem in any Python frameworks.)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants