Skip to content

Commit 482abdb

Browse files
xray trace clickification userscript
1 parent 72ef8d8 commit 482abdb

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
// ==UserScript==
2+
// @name XRay Trace Clickification
3+
// @namespace http://jonathanpezzino.com
4+
// @version 0.1
5+
// @description try to take over the world!
6+
// @author softwareengineerprogrammer
7+
// @match https://*.console.aws.amazon.com/cloudwatch/*
8+
// @grant none
9+
// ==/UserScript==
10+
11+
(function () {
12+
'use strict';
13+
const clickifiedAttr = 'xray_trace_clickified';
14+
15+
let clickify = function () {
16+
let traceIdElts = document.querySelectorAll(`div[data-test-id$="xray_trace_id-value"]:not([${clickifiedAttr}])`);
17+
console.debug('Found', traceIdElts.length, 'unclickified trace ID elements');
18+
traceIdElts.forEach(it => {
19+
let traceId = it.innerText;
20+
console.debug('Found xray trace ID:', traceId);
21+
let xrayLink = document.createElement('a');
22+
xrayLink.innerText = 'trace';
23+
xrayLink.target = '_blank';
24+
let region = 'us-west-2' // FIXME TODO
25+
xrayLink.href = `https://us-west-2.console.aws.amazon.com/cloudwatch/home?region=us-west-2#servicelens:traces/${traceId}?~(query~()~context~())`
26+
it.querySelector('.kvp-value').appendChild(xrayLink);
27+
it.setAttribute(clickifiedAttr, 'true');
28+
});
29+
};
30+
31+
setInterval(clickify, 2000);
32+
})();

0 commit comments

Comments
 (0)