Uploaded image for project: 'Jenkins'
  1. Jenkins
  2. JENKINS-53286

Enable Sentry user capturing

    XMLWordPrintable

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Minor
    • Resolution: Fixed
    • Component/s: evergreen
    • Labels:
      None
    • Similar Issues:
    • Sprint:
      Evergreen - Milestone 1

      Description

      User capturing is not enabled, hence makes it harder to automatically correlate messages from the same user in Sentry UI

      When working on JENKINS-53251, I see the "User" field on the top right always at 0:

      Expected behavior

      Reading https://docs.sentry.io/learn/context/#capturing-the-user, I think that we only have to change our code in two places in sentry.js.

      Instead of

      Raven.captureMessage(data.log.message, {
        level: data.log.level.toLowerCase(),
        logger: data.log.name,
        extra: {
          uuid: data.uuid,
          source: data.log
        }
      });
      

      We should use `id` field instead of `uuid`, i.e.:

      Raven.captureMessage(data.log.message, {
        level: data.log.level.toLowerCase(),
        logger: data.log.name,
        extra: {
          id: data.uuid,
          source: data.log
        }
      });
      

        Attachments

          Issue Links

            Activity

            batmat Baptiste Mathus created issue -
            batmat Baptiste Mathus made changes -
            Field Original Value New Value
            Epic Link JENKINS-51299 [ 190634 ]
            batmat Baptiste Mathus made changes -
            Attachment user count always 0.png [ 43923 ]
            batmat Baptiste Mathus made changes -
            Description h3. User capturing is not enabled, hence makes it harder to automatically correlate messages from the same user in Sentry UI

            When working on JENKINS-53251, I see the "User" field on the top right always at 0.

            My understanding is that we should send https://docs.sentry.io/learn/context/#capturing-the-user
            h3. User capturing is not enabled, hence makes it harder to automatically correlate messages from the same user in Sentry UI

            When working on JENKINS-53251, I see the "User" field on the top right always at 0:
             !user count always 0.png!

            h3. Expected behavior

            Reading https://docs.sentry.io/learn/context/#capturing-the-user, I _think_ that we only have to change our code in two places in [sentry.js|https://github.com/jenkins-infra/evergreen/blob/fc4875a6d112f7bca2d1080e301125703de63285/services/src/libs/sentry.js#L47].

            Instead of

            {code:js}
            Raven.captureMessage(data.log.message, {
              level: data.log.level.toLowerCase(),
              logger: data.log.name,
              extra: {
                uuid: data.uuid,
                source: data.log
              }
            });
            {code}

            We should use `id` field instead of `uuid`, i.e.:
            {code:js}
            Raven.captureMessage(data.log.message, {
              level: data.log.level.toLowerCase(),
              logger: data.log.name,
              extra: {
                id: data.uuid,
                source: data.log
              }
            });
            {code}
            batmat Baptiste Mathus made changes -
            Assignee R. Tyler Croy [ rtyler ] Baptiste Mathus [ batmat ]
            batmat Baptiste Mathus made changes -
            Status Open [ 1 ] In Progress [ 3 ]
            batmat Baptiste Mathus made changes -
            Remote Link This issue links to "evergreen PR (Web Link)" [ 21405 ]
            batmat Baptiste Mathus made changes -
            Status In Progress [ 3 ] In Review [ 10005 ]
            batmat Baptiste Mathus made changes -
            Link This issue relates to JENKINS-53251 [ JENKINS-53251 ]
            batmat Baptiste Mathus made changes -
            Resolution Fixed [ 1 ]
            Status In Review [ 10005 ] Resolved [ 5 ]
            Hide
            batmat Baptiste Mathus added a comment -

            So it does not work, and Sentry support confirms I didn't do the right thing.

            I sent

            Hello,
            
            Since recently, we'd modified our code to also send an `id` along with our messages to "capture the user" (https://docs.sentry.io/learn/context/#capturing-the-user).
            
            But for instance for `EVERGREEN-1E` I still see the "USERS" field stay at 0 when I do see the `id` specified.
            
            Can you help and tell us what we're missing here?
            
            FWIW, here is the PR where we thought we enabled the feature: https://github.com/jenkins-infra/evergreen/pull/204
            
            Thanks!
            

            They answered:

            	
            Katie [REDACTED] (Sentry)
            
            Sep 7, 11:10 MST
            
            Good morning!
            
            Thanks for reaching out. I think the trouble you're running into is that there's a difference between "user" context and "extra" context. Check out the examples here. Extra context is basically a collection of arbitrary key-value pairs which can be useful information for you, but which don't map to the user in any way. User context, on the other hand, is mapped to the user field in the event.
            
            Hope this helps. Please let me know if you have any other questions.
            
            Thanks,
            Katie
            Sentry Support Engineer
            
            Show
            batmat Baptiste Mathus added a comment - So it does not work, and Sentry support confirms I didn't do the right thing. I sent Hello, Since recently, we'd modified our code to also send an `id` along with our messages to "capture the user" (https://docs.sentry.io/learn/context/#capturing-the-user). But for instance for `EVERGREEN-1E` I still see the "USERS" field stay at 0 when I do see the `id` specified. Can you help and tell us what we're missing here? FWIW, here is the PR where we thought we enabled the feature: https://github.com/jenkins-infra/evergreen/pull/204 Thanks! They answered: Katie [REDACTED] (Sentry) Sep 7, 11:10 MST Good morning! Thanks for reaching out. I think the trouble you're running into is that there's a difference between "user" context and "extra" context. Check out the examples here. Extra context is basically a collection of arbitrary key-value pairs which can be useful information for you, but which don't map to the user in any way. User context, on the other hand, is mapped to the user field in the event. Hope this helps. Please let me know if you have any other questions. Thanks, Katie Sentry Support Engineer
            batmat Baptiste Mathus made changes -
            Resolution Fixed [ 1 ]
            Status Resolved [ 5 ] Reopened [ 4 ]
            rtyler R. Tyler Croy made changes -
            Assignee Baptiste Mathus [ batmat ] R. Tyler Croy [ rtyler ]
            Hide
            rtyler R. Tyler Croy added a comment -

            Looks like we got this deployed!

            Show
            rtyler R. Tyler Croy added a comment - Looks like we got this deployed!
            rtyler R. Tyler Croy made changes -
            Resolution Fixed [ 1 ]
            Status Reopened [ 4 ] Fixed but Unreleased [ 10203 ]
            rtyler R. Tyler Croy made changes -
            Sprint Evergreen - Milestone 1 [ 511 ] Evergreen - Milestone 1, Evergreen - Milestone 2 [ 511, 516 ]
            Hide
            batmat Baptiste Mathus added a comment -

            We did. We now definitely have that feature enabled in Sentry UI.

            Show
            batmat Baptiste Mathus added a comment - We did. We now definitely have that feature enabled in Sentry UI.
            batmat Baptiste Mathus made changes -
            Sprint Evergreen - Milestone 1, Evergreen - Milestone 2 [ 511, 516 ] Evergreen - Milestone 1 [ 511 ]
            batmat Baptiste Mathus made changes -
            Status Fixed but Unreleased [ 10203 ] Closed [ 6 ]

              People

              Assignee:
              rtyler R. Tyler Croy
              Reporter:
              batmat Baptiste Mathus
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: