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

Add data-sentry string to the breadcrumb message #5100

Merged
merged 2 commits into from
Sep 10, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions contribs/gmf/src/controllers/AbstractAppController.js
Original file line number Diff line number Diff line change
Expand Up @@ -682,6 +682,9 @@ export function AbstractAppController(config, map, $scope, $injector) {
const options = $injector.get('sentryOptions');
const tags = options.tags || [];
delete options.tags;
Object.assign(options, {
beforeBreadcrumb: augmentBreadcrumb
});
Sentry.init(options);
for (const tag in tags) {
Sentry.setTag(tag, tags[tag]);
Expand Down Expand Up @@ -820,6 +823,23 @@ export function getLocationIcon() {
}


/**
* @param {Sentry.Breadcrumb} breadcrumb
* @param {Sentry.BreadcrumbHint} hint
*/
function augmentBreadcrumb(breadcrumb, hint) {
if (breadcrumb.category === 'ui.click') {
const target = hint.event.target;
if (target) {
const message = target.dataset.sentry;
if (message) {
breadcrumb.message = `${breadcrumb.message} | ${message}`;
}
Copy link
Member

Choose a reason for hiding this comment

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

Shouldn't we have more information with something like:?

const tags = []

function browse(element) {
    if (element) {
        const message = target.dataset.sentry;
        if (message) {
            tags.append(`${element.tagName}.${message}`);
        } else {
            tags.append(element.tagName);
        }
        browse(element.parentElement);
    }
}

browse(hint.event.target);
if (tags) {
  breadcrumb.message = `${breadcrumb.message} | ${tags.join('-')}`;
}

}
}
}


/**
* @type {angular.IModule}
* @hidden
Expand Down
1 change: 1 addition & 0 deletions contribs/gmf/src/layertree/component.html
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@

<a
href
data-sentry="id:{{layertreeCtrl.node.id}}"
ng-click="::gmfLayertreeCtrl.toggleActive(layertreeCtrl)"
class="gmf-layertree-name"
data-toggle="tooltip"
Expand Down