use of com.palantir.tracing.TagTranslator in project dialogue by palantir.
the class DialogueTracing method responseTranslator.
static TagTranslator<Response> responseTranslator(ImmutableMap<String, String> tags) {
return new TagTranslator<>() {
@Override
public <T> void translate(TagAdapter<T> sink, T target, Response response) {
sink.tag(target, tags);
int status = response.code();
sink.tag(target, "outcome", status / 100 == 2 ? "success" : "failure");
sink.tag(target, TraceTags.HTTP_STATUS_CODE, Integer.toString(status));
}
};
}
Aggregations