Search in sources :

Example 1 with TagTranslator

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));
        }
    };
}
Also used : Response(com.palantir.dialogue.Response) TagTranslator(com.palantir.tracing.TagTranslator) Endpoint(com.palantir.dialogue.Endpoint)

Aggregations

Endpoint (com.palantir.dialogue.Endpoint)1 Response (com.palantir.dialogue.Response)1 TagTranslator (com.palantir.tracing.TagTranslator)1