From 1a34766893d894570f21369dd46ebc799b29144c Mon Sep 17 00:00:00 2001 From: Carlos Alberto Cortez Date: Thu, 4 Apr 2019 17:45:06 +0200 Subject: [PATCH] Rename Span.putAttribute*() to Span.setAttribute*() --- api/src/main/java/openconsensus/trace/BlankSpan.java | 4 ++-- api/src/main/java/openconsensus/trace/Span.java | 8 ++++---- .../main/java/openconsensus/opentracingshim/SpanShim.java | 8 ++++---- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/api/src/main/java/openconsensus/trace/BlankSpan.java b/api/src/main/java/openconsensus/trace/BlankSpan.java index d9a1d22e4c3..9894b5cd4aa 100644 --- a/api/src/main/java/openconsensus/trace/BlankSpan.java +++ b/api/src/main/java/openconsensus/trace/BlankSpan.java @@ -45,13 +45,13 @@ public final class BlankSpan extends Span { private BlankSpan() {} @Override - public void putAttribute(String key, AttributeValue value) { + public void setAttribute(String key, AttributeValue value) { Utils.checkNotNull(key, "key"); Utils.checkNotNull(value, "value"); } @Override - public void putAttributes(Map attributes) { + public void setAttributes(Map attributes) { Utils.checkNotNull(attributes, "attributes"); } diff --git a/api/src/main/java/openconsensus/trace/Span.java b/api/src/main/java/openconsensus/trace/Span.java index d5f6a31cf09..fd388ba8063 100644 --- a/api/src/main/java/openconsensus/trace/Span.java +++ b/api/src/main/java/openconsensus/trace/Span.java @@ -41,17 +41,17 @@ public abstract class Span { * @param value the value for this attribute. * @since 0.1.0 */ - public abstract void putAttribute(String key, AttributeValue value); + public abstract void setAttribute(String key, AttributeValue value); /** * Sets a set of attributes to the {@code Span}. The effect of this call is equivalent to that of - * calling {@link #putAttribute(String, AttributeValue)} once for each element in the specified + * calling {@link #setAttribute(String, AttributeValue)} once for each element in the specified * map. * * @param attributes the attributes that will be added and associated with the {@code Span}. * @since 0.1.0 */ - public abstract void putAttributes(Map attributes); + public abstract void setAttributes(Map attributes); /** * Adds an event to the {@code Span}. @@ -66,7 +66,7 @@ public abstract class Span { * * @param name the name of the event. * @param attributes the attributes that will be added; these are associated with this event, not - * the {@code Span} as for {@link #putAttributes(Map)}. + * the {@code Span} as for {@link #setAttributes(Map)}. * @since 0.1.0 */ public abstract void addEvent(String name, Map attributes); diff --git a/opentracing-shim/src/main/java/openconsensus/opentracingshim/SpanShim.java b/opentracing-shim/src/main/java/openconsensus/opentracingshim/SpanShim.java index 175c24a1957..b22ecc36589 100644 --- a/opentracing-shim/src/main/java/openconsensus/opentracingshim/SpanShim.java +++ b/opentracing-shim/src/main/java/openconsensus/opentracingshim/SpanShim.java @@ -42,13 +42,13 @@ public SpanContext context() { @Override public Span setTag(String key, String value) { - span.putAttribute(key, AttributeValue.stringAttributeValue(value)); + span.setAttribute(key, AttributeValue.stringAttributeValue(value)); return this; } @Override public Span setTag(String key, boolean value) { - span.putAttribute(key, AttributeValue.booleanAttributeValue(value)); + span.setAttribute(key, AttributeValue.booleanAttributeValue(value)); return this; } @@ -56,9 +56,9 @@ public Span setTag(String key, boolean value) { public Span setTag(String key, Number value) { // TODO - Verify only the 'basic' types are supported/used. if (value instanceof Integer || value instanceof Long) { - span.putAttribute(key, AttributeValue.longAttributeValue(value.longValue())); + span.setAttribute(key, AttributeValue.longAttributeValue(value.longValue())); } else if (value instanceof Float || value instanceof Double) { - span.putAttribute(key, AttributeValue.doubleAttributeValue(value.doubleValue())); + span.setAttribute(key, AttributeValue.doubleAttributeValue(value.doubleValue())); } else { throw new IllegalArgumentException("Number type not supported"); }