private static Tag uri ( RequestLog requestLog ) { int status = requestLog . statusCode ( ) ; if ( status > 299 && status < 400 ) return URI_REDIRECTION ; if ( status == 404 ) return URI_NOT_FOUND ; String uri = getPathInfo ( requestLog ) ; if ( uri . startsWith ( "/zipkin" ) ) { if ( uri . equals ( "/zipkin/" ) || uri . equals ( "/zipkin" ) || uri . startsWith ( "/zipkin/traces/" ) || uri . equals ( "/zipkin/dependency" ) || uri . equals ( "/zipkin/traceViewer" ) ) { return URI_CROSSROADS ; // single-page app route } // un-map UI's api route if ( uri . startsWith ( "/zipkin/api" ) ) { uri = uri . replaceFirst ( "/zipkin" , "" ) ; } } // handle templated routes instead of exploding on trace ID cardinality if ( uri . startsWith ( "/api/v2/trace/" ) ) return URI_TRACE_V2 ; return Tag . of ( "uri" , uri ) ; }
Ensure metrics cardinality doesn t blow up on variables