Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dialogue uses standard tracing tags #1216

Merged
merged 2 commits into from
Apr 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog/@unreleased/pr-1216.v2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
type: improvement
improvement:
description: Dialogue uses standard tracing tags
links:
- https://github.com/palantir/dialogue/pull/1216
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import com.palantir.dialogue.Response;
import com.palantir.tracing.TagTranslator;
import com.palantir.tracing.TagTranslator.TagAdapter;
import com.palantir.tracing.api.TraceTags;
import java.util.Map;

/** Internal utility functionality to support tracing dialogue requests. */
Expand All @@ -33,6 +34,7 @@ enum EndpointTagTranslator implements TagTranslator<Endpoint> {
public <T> void translate(TagAdapter<T> adapter, T target, Endpoint endpoint) {
adapter.tag(target, "endpointService", endpoint.serviceName());
adapter.tag(target, "endpointName", endpoint.endpointName());
adapter.tag(target, TraceTags.HTTP_METHOD, endpoint.httpMethod().toString());
}
}

Expand All @@ -57,7 +59,7 @@ 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, "status", Integer.toString(status));
sink.tag(target, TraceTags.HTTP_STATUS_CODE, Integer.toString(status));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could probably also centralize the int -> String for status codes? I think you have that multi-if-statement in abunch of places.

}
};
}
Expand Down
6 changes: 3 additions & 3 deletions versions.lock
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ com.palantir.safe-logging:preconditions:1.14.0 (14 constraints: 3ae7b5cd)
com.palantir.safe-logging:safe-logging:1.14.0 (10 constraints: e89dc74c)
com.palantir.safethreadlocalrandom:safe-thread-local-random:0.1.0 (1 constraints: 0305ee35)
com.palantir.tokens:auth-tokens:3.8.1 (3 constraints: 9427472f)
com.palantir.tracing:tracing:4.14.0 (2 constraints: 5616040e)
com.palantir.tracing:tracing-api:4.14.0 (2 constraints: 0b120918)
com.palantir.tracing:tracing:4.18.0 (2 constraints: 5e16e00e)
com.palantir.tracing:tracing-api:4.18.0 (2 constraints: 1312b918)
com.palantir.tritium:tritium-api:0.18.8 (2 constraints: 431f80be)
com.palantir.tritium:tritium-core:0.18.8 (1 constraints: 49104ca2)
com.palantir.tritium:tritium-metrics:0.18.8 (1 constraints: 4305433b)
Expand Down Expand Up @@ -73,7 +73,7 @@ com.google.code.findbugs:annotations:3.0.1 (1 constraints: 9e0aafc3)
com.google.testing.compile:compile-testing:0.19 (1 constraints: de04f630)
com.google.truth:truth:1.1 (1 constraints: b71111d7)
com.palantir.safe-logging:preconditions-assertj:1.14.0 (1 constraints: 3805353b)
com.palantir.tracing:tracing-test-utils:4.14.0 (1 constraints: 3b05473b)
com.palantir.tracing:tracing-test-utils:4.18.0 (1 constraints: 3f05533b)
com.spotify.dataenum:dataenum:1.3.2 (1 constraints: e91058c1)
com.squareup.okhttp3:mockwebserver:3.13.1 (1 constraints: 3a053f3b)
commons-logging:commons-logging:1.2 (2 constraints: 8215ead1)
Expand Down
2 changes: 1 addition & 1 deletion versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ com.palantir.ri:resource-identifier = 1.1.0
com.palantir.safe-logging:* = 1.14.0
com.palantir.safethreadlocalrandom:safe-thread-local-random = 0.1.0
com.palantir.tokens:auth-tokens = 3.8.1
com.palantir.tracing:* = 4.14.0
com.palantir.tracing:* = 4.18.0
com.palantir.tritium:* = 0.18.8
com.squareup:javapoet = 1.13.0
com.uber.nullaway:nullaway = 0.9.0
Expand Down