File tree Expand file tree Collapse file tree 3 files changed +6
-9
lines changed
packages/kbn-apm-synthtrace-client/src/lib
x-pack/solutions/observability/plugins/apm/ftr_e2e/cypress/e2e/errors Expand file tree Collapse file tree 3 files changed +6
-9
lines changed Original file line number Diff line number Diff line change 77 * License v3.0 only", or the "Server Side Public License, v 1".
88 */
99
10- import { createHash } from 'crypto' ;
1110import { ApmError } from './apm_error' ;
1211import { Entity } from '../entity' ;
1312import { Metricset } from './metricset' ;
@@ -114,7 +113,3 @@ export class Instance extends Entity<ApmFields> {
114113 } ) ;
115114 }
116115}
117-
118- export function getErrorGroupingKey ( content : string ) {
119- return createHash ( 'sha256' ) . update ( content ) . digest ( 'hex' ) ;
120- }
Original file line number Diff line number Diff line change @@ -24,7 +24,10 @@ function generateId(length: number = LONG_ID_LENGTH) {
2424}
2525
2626function generateIdWithSeed ( seed : string , length : number = LONG_ID_LENGTH ) {
27- return seed ?. padStart ( length , '0' ) ;
27+ // this is needed to sanitize errors like "No handler for /order/{id}",
28+ // as encodeURIComponent is not enough and can cause errors in the client
29+ const encodedSeed = seed . replace ( / [ / ] / g, '_' ) . replace ( / [ { } ] / g, '' ) ;
30+ return encodedSeed ?. padStart ( length , '0' ) ;
2831}
2932
3033export function generateShortId ( ) {
Original file line number Diff line number Diff line change 55 * 2.0.
66 */
77
8- import { getErrorGroupingKey } from '@kbn/apm-synthtrace-client/src/lib/apm/instance' ;
98import { generateLongIdWithSeed } from '@kbn/apm-synthtrace-client/src/lib/utils/generate_id' ;
109
1110import url from 'url' ;
@@ -36,7 +35,7 @@ describe('Error details', () => {
3635 } ) ;
3736
3837 it ( 'has no detectable a11y violations on load' , ( ) => {
39- const errorGroupingKey = getErrorGroupingKey ( 'Error 1' ) ;
38+ const errorGroupingKey = generateLongIdWithSeed ( 'Error 1' ) ;
4039 const errorGroupingKeyShort = errorGroupingKey . slice ( 0 , 5 ) ;
4140 const errorDetailsPageHref = url . format ( {
4241 pathname : `/app/apm/services/opbeans-java/errors/${ errorGroupingKey } ` ,
@@ -54,7 +53,7 @@ describe('Error details', () => {
5453
5554 describe ( 'when error has no occurrences' , ( ) => {
5655 it ( 'shows zero occurrences' , ( ) => {
57- const errorGroupingKey = getErrorGroupingKey ( 'Error foo bar' ) ;
56+ const errorGroupingKey = generateLongIdWithSeed ( 'Error foo bar' ) ;
5857
5958 cy . visitKibana (
6059 url . format ( {
You can’t perform that action at this time.
0 commit comments