diff options
| author | Bogdan Drutu <bdrutu@google.com> | 2017-08-29 22:33:13 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-08-29 22:33:13 -0700 |
| commit | 1fb102567c48b02ece1f8a7d8ba50cacab1f46d1 (patch) | |
| tree | 9aeecbfd21c38d3e6c07928c78859d40cf0637bc /contrib/zpages | |
| parent | 45f115a4c5966ebc8ec4fd04bafe8f967915703e (diff) | |
| download | platform_external_opencensus-java-1fb102567c48b02ece1f8a7d8ba50cacab1f46d1.tar.gz platform_external_opencensus-java-1fb102567c48b02ece1f8a7d8ba50cacab1f46d1.tar.bz2 platform_external_opencensus-java-1fb102567c48b02ece1f8a7d8ba50cacab1f46d1.zip | |
Add new api that is easier to use for user to add only one Attribute. (#571)
* Add new api that is easier to use for user to add only one Attribute.
* Rename addAttribute[s] to putAttribute[s] and deprecate the old API.
* Update tests to use putAttributes.
Diffstat (limited to 'contrib/zpages')
| -rw-r--r-- | contrib/zpages/src/main/java/io/opencensus/contrib/zpages/ZPageHttpHandler.java | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/ZPageHttpHandler.java b/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/ZPageHttpHandler.java index d5e76bbf..9c05446b 100644 --- a/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/ZPageHttpHandler.java +++ b/contrib/zpages/src/main/java/io/opencensus/contrib/zpages/ZPageHttpHandler.java @@ -17,7 +17,6 @@ package io.opencensus.contrib.zpages; import com.google.common.annotations.VisibleForTesting; -import com.google.common.collect.ImmutableMap; import com.sun.net.httpserver.HttpExchange; import com.sun.net.httpserver.HttpHandler; import io.opencensus.common.Scope; @@ -56,12 +55,9 @@ final class ZPageHttpHandler implements HttpHandler { .startScopedSpan()) { tracer .getCurrentSpan() - .addAttributes( - ImmutableMap.<String, AttributeValue>builder() - .put( - "RequestMethod", - AttributeValue.stringAttributeValue(httpExchange.getRequestMethod())) - .build()); + .putAttribute( + "/http/method ", + AttributeValue.stringAttributeValue(httpExchange.getRequestMethod())); httpExchange.sendResponseHeaders(200, 0); zpageHandler.emitHtml( uriQueryToMap(httpExchange.getRequestURI()), httpExchange.getResponseBody()); |
