[decorators] fixed URLAsResourceName when the cast fails
This commit is contained in:
parent
2f383e667f
commit
abbb441270
|
@ -44,10 +44,12 @@ public class URLAsResourceName extends AbstractDecorator {
|
|||
@Override
|
||||
public boolean afterSetTag(final DDSpanContext context, final String tag, final Object value) {
|
||||
try {
|
||||
final String statusCode = (String) context.getTags().get(Tags.HTTP_STATUS.getKey());
|
||||
final String statusCode = String.valueOf(context.getTags().get(Tags.HTTP_STATUS.getKey()));
|
||||
// do nothing if the status code is already set and equals to 404.
|
||||
// TODO: it assumes that Status404Decorator is active. If it's not, it will lead to unexpected behaviors
|
||||
if (statusCode != null && statusCode.equals("404")) {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Get the path without host:port
|
||||
String path = String.valueOf(value);
|
||||
|
@ -66,12 +68,8 @@ public class URLAsResourceName extends AbstractDecorator {
|
|||
path = verb + " " + path;
|
||||
}
|
||||
|
||||
//Assign resource name
|
||||
context.setResourceName(path);
|
||||
}
|
||||
|
||||
} catch (final Throwable e) {
|
||||
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
|
|
Loading…
Reference in New Issue