File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed
Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change 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+ } ) ( ) ;
You can’t perform that action at this time.
0 commit comments