Skip to content

Add more detailed logging of errors in Jira service

What does this MR do?

Issue #198411 (closed)

As described in #195794 (closed), we are having issues with the Jira integration and are unable to replicate the issue. This MR aims to assist us with better logging to identify the issue.

By logging the full request from Jira (including the body), we get the full message from Jira instead of a generic "erro" generated by the class. This should help us see at least what is happening on Jira's side.

Screenshots

Sample log with wrong password

{
  "severity": "ERROR",
  "time": "2020-02-17T14:48:57.916Z",
  "correlation_id": "cnHmOawGpq",
  "tags.correlation_id": "cnHmOawGpq",
  "tags.locale": "en",
  "user.id": 1,
  "user.email": "admin@example.com",
  "user.username": "root",
  "extra.server": {
    "os": {
      "name": "Darwin",
      "version": "Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64",
      "build": "19.0.0",
      "kernel_version": "Darwin Justins-MacBook-Pro.local 19.0.0 Darwin Kernel Version 19.0.0: Thu Oct 17 16:17:15 PDT 2019; root:xnu-6153.41.3~29/RELEASE_X86_64 x86_64"
    },
    "runtime": {
      "name": "ruby",
      "version": "ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-darwin18]"
    }
  },
  "extra.response": {
    "x-arequestid": [
      "888x829x1"
    ],
    "x-xss-protection": [
      "1; mode=block"
    ],
    "x-content-type-options": [
      "nosniff"
    ],
    "x-frame-options": [
      "SAMEORIGIN"
    ],
    "content-security-policy": [
      "frame-ancestors 'self'"
    ],
    "x-asen": [
      "SEN-14725308"
    ],
    "x-seraph-loginreason": [
      "AUTHENTICATED_FAILED"
    ],
    "www-authenticate": [
      "OAuth realm=\"http%3A%2F%2F34.66.109.3%3A8080\""
    ],
    "content-type": [
      "text/html;charset=UTF-8"
    ],
    "transfer-encoding": [
      "chunked"
    ],
    "date": [
      "Mon, 17 Feb 2020 14:48:57 GMT"
    ],
    "connection": [
      "close"
    ]
  },
  "extra.response_body": "\n\n\n\n\n\n\n\n\n\n<html>\n\n<head>\n    <title>Unauthorized (401)</title>\n    \n\n\n\n<!--[if IE]><![endif]-->\n<script type=\"text/javascript\">\n    (function() {\n        var contextPath = '';\n        var eventBuffer = [];\n\n        function printDeprecatedMsg() {\n            if (console && console.warn) {\n                console.warn('DEPRECATED JS - contextPath global variable has been deprecated since 7.4.0. Use `wrm/context-path` module instead.');\n            }\n        }\n\n        function sendEvent(analytics, postfix) {\n            analytics.send({\n                name: 'js.globals.contextPath.' + postfix\n            });\n        }\n\n        function sendDeprecatedEvent(postfix) {\n            try {\n                var analytics = require('jira/analytics');\n                if (eventBuffer.length) {\n                    eventBuffer.forEach(function(value) {\n                        sendEvent(analytics, value);\n                    });\n                    eventBuffer = [];\n                }\n\n                if (postfix) {\n                    sendEvent(analytics, postfix);\n                }\n            } catch(ex) {\n                eventBuffer.push(postfix);\n                setTimeout(sendDeprecatedEvent, 1000);\n            }\n        }\n\n        Object.defineProperty(window, 'contextPath', {\n            get: function() {\n                printDeprecatedMsg();\n                sendDeprecatedEvent('get');\n                return contextPath;\n            },\n            set: function(value) {\n                printDeprecatedMsg();\n                sendDeprecatedEvent('set');\n                contextPath = value;\n            }\n        });\n    })();\n\n</script>\n<script>\nwindow.WRM=window.WRM||{};window.WRM._unparsedData=window.WRM._unparsedData||{};window.WRM._unparsedErrors=window.WRM._unparsedErrors||{};\nWRM._unparsedData[\"com.atlassian.plugins.atlassian-plugins-webresource-plugin:context-path.context-path\"]=\"\\\"\\\"\";\nWRM._unparsedData[\"jira.core:feature-flags-data.feature-flag-data\"]=\"{\\\"enabled-feature-keys\\\":[\\\"nps.survey.inline.dialog\\\",\\\"com.atlassian.jira.agile.darkfeature.edit.closed.sprint.enabled\\\",\\\"jira.plugin.devstatus.phasetwo\\\",\\\"jira.frother.reporter.field\\\",\\\"atlassian.rest.xsrf.legacy.enabled\\\",\\\"jira.issue.status.lozenge\\\",\\\"com.atlassian.jira.config.BIG_PIPE\\\",\\\"com.atlassian.jira.projects.issuenavigator\\\",\\\"com.atlassian.jira.config.PDL\\\",\\\"jira.plugin.devstatus.phasetwo.enabled\\\",\\\"atlassian.aui.raphael.disabled\\\",\\\"app-switcher.new\\\",\\\"frother.assignee.field\\\",\\\"com.atlassian.jira.projects.ProjectCentricNavigation.Switch\\\",\\\"jira.onboarding.cyoa\\\",\\\"com.atlassian.jira.agile.darkfeature.kanplan.enabled\\\",\\\"com.atlassian.jira.config.ProjectConfig.MENU\\\",\\\"com.atlassian.jira.projects.sidebar.DEFER_RESOURCES\\\",\\\"com.atlassian.jira.agile.darkfeature.kanplan.epics.and.versions.enabled\\\",\\\"com.atlassian.jira.agile.darkfeature.sprint.goal.enabled\\\",\\\"jira.zdu.admin-updates-ui\\\",\\\"jira.zdu.jmx-monitoring\\\",\\\"sd.new.settings.sidebar.location.disabled\\\",\\\"jira.zdu.cluster-upgrade-state\\\",\\\"com.atlassian.jira.agile.darkfeature.splitissue\\\",\\\"com.atlassian.jira.config.CoreFeatures.LICENSE_ROLES_ENABLED\\\",\\\"jira.export.csv.enabled\\\"],\\\"feature-flag-states\\\":{\\\"mail.batching.override.core\\\":true,\\\"com.atlassian.jira.issues.archiving.filters\\\":false,\\\"jira.spectrum.m1\\\":true,\\\"atlassian.cdn.static.assets\\\":true,\\\"com.atlassian.jira.issuetable.draggable\\\":true,\\\"mail.batching\\\":false,\\\"sd.users.and.roles.new.page\\\":false,\\\"jira.jql.suggestrecentfields\\\":false,\\\"jira.priorities.per.project.edit.default\\\":false,\\\"com.atlassian.jira.issuetable.move.links.hidden\\\":true,\\\"jira.renderer.consider.variable.format\\\":true,\\\"com.atlassian.jira.user.dbIdBasedKeyGenerationStrategy\\\":false,\\\"jira.priorities.per.project.jsd\\\":true,\\\"com.atlassian.jira.issues.archiving.browse\\\":false,\\\"jira.instrumentation.laas\\\":false,\\\"com.atlassian.jira.sharedEntityEditRights\\\":true,\\\"jira.customfields.paginated.ui\\\":true,\\\"jira.create.linked.issue\\\":true,\\\"mail.batching.user.notification\\\":true,\\\"jira.dc.lock.leasing\\\":true,\\\"mail.batching.create.section.cf\\\":true,\\\"jira.sal.host.connect.accessor.existing.transaction.will.create.transactions\\\":true,\\\"com.atlassian.jira.custom.csv.escaper\\\":true,\\\"com.atlassian.jira.plugin.issuenavigator.filtersUxImprovment\\\":true,\\\"jira.quick.search\\\":true,\\\"jira.jql.smartautoselectfirst\\\":false,\\\"com.atlassian.jira.projects.per.project.permission.query\\\":true,\\\"com.atlassian.jira.issues.archiving\\\":true,\\\"com.atlassian.jira.projects.archiving\\\":true,\\\"index.use.snappy\\\":true,\\\"jira.priorities.per.project\\\":true,\\\"com.atlassian.jira.upgrade.startup.fix.index\\\":true}}\";\nWRM._unparsedData[\"jira.core:default-comment-security-level-data.DefaultCommentSecurityLevelHelpLink\"]=\"{\\\"extraClasses\\\":\\\"default-comment-level-help\\\",\\\"title\\\":\\\"Commenting on an Issue\\\",\\\"url\\\":\\\"https://docs.atlassian.com/jira/jcore-docs-083/Editing+and+collaborating+on+issues#Editingandcollaboratingonissues-restrictacomment\\\",\\\"isLocal\\\":false}\";\nWRM._unparsedData[\"com.atlassian.analytics.analytics-client:policy-update-init.policy-update-data-provider\"]=\"false\";\nWRM._unparsedData[\"com.atlassian.analytics.analytics-client:programmatic-analytics-init.programmatic-analytics-data-provider\"]=\"false\";\nWRM._unparsedData[\"jira.core:dateFormatProvider.allFormats\"]=\"{\\\"dateFormats\\\":{\\\"meridiem\\\":[\\\"AM\\\",\\\"PM\\\"],\\\"eras\\\":[\\\"BC\\\",\\\"AD\\\"],\\\"months\\\":[\\\"January\\\",\\\"February\\\",\\\"March\\\",\\\"April\\\",\\\"May\\\",\\\"June\\\",\\\"July\\\",\\\"August\\\",\\\"September\\\",\\\"October\\\",\\\"November\\\",\\\"December\\\"],\\\"monthsShort\\\":[\\\"Jan\\\",\\\"Feb\\\",\\\"Mar\\\",\\\"Apr\\\",\\\"May\\\",\\\"Jun\\\",\\\"Jul\\\",\\\"Aug\\\",\\\"Sep\\\",\\\"Oct\\\",\\\"Nov\\\",\\\"Dec\\\"],\\\"weekdaysShort\\\":[\\\"Sun\\\",\\\"Mon\\\",\\\"Tue\\\",\\\"Wed\\\",\\\"Thu\\\",\\\"Fri\\\",\\\"Sat\\\"],\\\"weekdays\\\":[\\\"Sunday\\\",\\\"Monday\\\",\\\"Tuesday\\\",\\\"Wednesday\\\",\\\"Thursday\\\",\\\"Friday\\\",\\\"Saturday\\\"]},\\\"lookAndFeelFormats\\\":{\\\"relativize\\\":\\\"true\\\",\\\"time\\\":\\\"h:mm a\\\",\\\"day\\\":\\\"EEEE h:mm a\\\",\\\"dmy\\\":\\\"dd/MMM/yy\\\",\\\"complete\\\":\\\"dd/MMM/yy h:mm a\\\"}}\";\nWRM._unparsedData[\"jira.core:avatar-picker-data.data\"]=\"{}\";\nWRM._unparsedData[\"com.atlassian.jira.jira-header-plugin:dismissedFlags.flags\"]=\"{\\\"dismissed\\\":[]}\";\nWRM._unparsedData[\"com.atlassian.jira.jira-header-plugin:newsletter-signup-tip-init.newsletterSignup\"]=\"{\\\"signupDescription\\\":\\\"Get updates, inspiration and best practices from the team behind Jira.\\\",\\\"formUrl\\\":\\\"https://www.atlassian.com/apis/exact-target/{0}/subscribe?mailingListId=1401671\\\",\\\"signupTitle\\\":\\\"Sign up!\\\",\\\"signupId\\\":\\\"newsletter-signup-tip\\\",\\\"showNewsletterTip\\\":false}\";\nWRM._unparsedData[\"com.atlassian.jira.project-templates-plugin:project-templates-plugin-resources.ptAnalyticsData\"]=\"{\\\"instanceCreatedDate\\\":\\\"2019-08-22\\\"}\";\nWRM._unparsedData[\"com.atlassian.whisper.atlassian-whisper-plugin:atlassian-whisper-bootstrap.WhisperData\"]=\"{\\\"hasMessages\\\":false,\\\"syncInit\\\":false,\\\"baseUrl\\\":\\\"http:\\\\/\\\\/34.66.109.3:8080\\\"}\";\nWRM._unparsedData[\"jira.core:user-message-flags-data.adminLockout\"]=\"{}\";\nWRM._unparsedData[\"com.atlassian.plugins.helptips.jira-help-tips:help-tip-manager.JiraHelpTipData\"]=\"{\\\"anonymous\\\":true}\";\nif(window.WRM._dataArrived)window.WRM._dataArrived();</script>\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/45f37bd50451154a29826eb89a4f3034-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/0a4716d29b2d5b1bdcdb168b4efc119e/_/download/contextbatch/css/_super/batch.css\" data-wrm-key=\"_super\" data-wrm-batch-type=\"context\" media=\"all\">\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/6b5cdfb166b4de00ae8f2ac85cfb070a-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/9a279a0ce72d36fb9e2b7d324670e4f2/_/download/contextbatch/css/atl.general,jira.global,-_super/batch.css?whisper-enabled=true\" data-wrm-key=\"atl.general,jira.global,-_super\" data-wrm-batch-type=\"context\" media=\"all\">\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.label/com.atlassian.auiplugin:split_aui.pattern.label.css\" data-wrm-key=\"com.atlassian.auiplugin:split_aui.pattern.label\" data-wrm-batch-type=\"resource\" media=\"all\">\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/d41d8cd98f00b204e9800998ecf8427e-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.splitchunk.16f099a0da/com.atlassian.auiplugin:split_aui.splitchunk.16f099a0da.css\" data-wrm-key=\"com.atlassian.auiplugin:split_aui.splitchunk.16f099a0da\" data-wrm-batch-type=\"resource\" media=\"all\">\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/f28e4034d85b87c01d22c293645882c8-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/1.0/_/download/batch/jira.webresources:global-static-adgs/jira.webresources:global-static-adgs.css\" data-wrm-key=\"jira.webresources:global-static-adgs\" data-wrm-batch-type=\"resource\" media=\"all\">\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/6ae1c92e1f4bca157dced8744a85346b-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/1.0/_/download/batch/jira.webresources:global-static/jira.webresources:global-static.css\" data-wrm-key=\"jira.webresources:global-static\" data-wrm-batch-type=\"resource\" media=\"all\">\n<script type=\"text/javascript\" src=\"/s/e9126ec4c9481522fbc75bb0c680fc50-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/0a4716d29b2d5b1bdcdb168b4efc119e/_/download/contextbatch/js/_super/batch.js?locale=en\" data-wrm-key=\"_super\" data-wrm-batch-type=\"context\" data-initially-rendered></script>\n<script type=\"text/javascript\" src=\"/s/6e00b07a3e17d5d7a2feff03aacec562-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/9a279a0ce72d36fb9e2b7d324670e4f2/_/download/contextbatch/js/atl.general,jira.global,-_super/batch.js?locale=en&amp;whisper-enabled=true\" data-wrm-key=\"atl.general,jira.global,-_super\" data-wrm-batch-type=\"context\" data-initially-rendered></script>\n<script type=\"text/javascript\" src=\"/s/2b55f130b10e1f3a18f85d531213bc0f-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/aae1242f5fc81cc6a5bb8bc963ccda29/_/download/contextbatch/js/atl.global,-_super/batch.js?locale=en\" data-wrm-key=\"atl.global,-_super\" data-wrm-batch-type=\"context\" data-initially-rendered></script>\n<script type=\"text/javascript\" src=\"/s/3101fdb865972c3504f1afe70a90d105-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.label/com.atlassian.auiplugin:split_aui.pattern.label.js?locale=en\" data-wrm-key=\"com.atlassian.auiplugin:split_aui.pattern.label\" data-wrm-batch-type=\"resource\" data-initially-rendered></script>\n<script type=\"text/javascript\" src=\"/s/3101fdb865972c3504f1afe70a90d105-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.splitchunk.16f099a0da/com.atlassian.auiplugin:split_aui.splitchunk.16f099a0da.js?locale=en\" data-wrm-key=\"com.atlassian.auiplugin:split_aui.splitchunk.16f099a0da\" data-wrm-batch-type=\"resource\" data-initially-rendered></script>\n<script type=\"text/javascript\" src=\"/s/3101fdb865972c3504f1afe70a90d105-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/8.0.5/_/download/batch/com.atlassian.auiplugin:split_aui.pattern.table/com.atlassian.auiplugin:split_aui.pattern.table.js?locale=en\" data-wrm-key=\"com.atlassian.auiplugin:split_aui.pattern.table\" data-wrm-batch-type=\"resource\" data-initially-rendered></script>\n<link type=\"text/css\" rel=\"stylesheet\" href=\"/s/16e8d090c930f1172f4ff093ef5ed341-CDN/-6abqyt/803003/6411e0087192541a09d88223fb51a6a0/bf1454a121ce33d77aeaf425f71c8017/_/download/contextbatch/css/jira.global.look-and-feel,-_super/batch.css\" data-wrm-key=\"jira.global.look-and-feel,-_super\" data-wrm-batch-type=\"context\" media=\"all\">\n\n<script type=\"text/javascript\" src=\"/rest/api/1.0/shortcuts/803003/90391248316c50ce8d4fe098bfb38398/shortcuts.js\"></script>\n\n\n    <meta name=\"application-name\" content=\"JIRA\" data-name=\"jira\" data-version=\"8.3.2\">\n</head>\n<body id=\"jira\" class=\"aui-layout aui-style-default page-type-message\"  data-version=\"8.3.2\" >\n    <div class=\"aui-page-panel\"><div class=\"aui-page-panel-inner\">\n            <section class=\"aui-page-panel-content\">\n                    <header class=\"aui-page-header\"><div class=\"aui-page-header-inner\">\n                            <div class=\"aui-page-header-main\">\n                                    <h1>Unauthorized (401)</h1>\n                                </div><!-- .aui-page-header-main -->\n                        </div><!-- .aui-page-header-inner --></header><!-- .aui-page-header -->\n                    <div class=\"aui-message aui-message-warning warning\">\n                            <p>Encountered a <code>&quot;401 - Unauthorized&quot;</code> error while loading this page.</p>\n                            <p>Basic Authentication Failure - Reason : AUTHENTICATED_FAILED</p>\n                            <p><a href=\"/secure/MyJiraHome.jspa\">Go to Jira home</a></p>\n                        </div>\n                </section><!-- .aui-page-panel-content -->\n        </div><!-- .aui-page-panel-inner --></div><!-- .aui-page-panel -->\n</body>\n</html>\n",
  "exception.class": "JIRA::HTTPError",
  "exception.message": ""
}

Does this MR meet the acceptance criteria?

Conformity

Availability and Testing

Security

If this MR contains changes to processing or storing of credentials or tokens, authorization and authentication methods and other items described in the security review guidelines:

  • Label as security and @ mention @gitlab-com/gl-security/appsec
  • The MR includes necessary changes to maintain consistency between UI, API, email, or other methods
  • Security reports checked/validated by a reviewer from the AppSec team
Edited by 🤖 GitLab Bot 🤖

Merge request reports