Rename Span.putAttribute*() to Span.setAttribute*() (#38)

This commit is contained in:
Carlos Alberto Cortez 2019-04-04 18:19:57 +02:00 committed by Ted Young
parent 56203806ad
commit 9daa388776
3 changed files with 10 additions and 10 deletions

View File

@ -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<String, AttributeValue> attributes) {
public void setAttributes(Map<String, AttributeValue> attributes) {
Utils.checkNotNull(attributes, "attributes");
}

View File

@ -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<String, AttributeValue> attributes);
public abstract void setAttributes(Map<String, AttributeValue> 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<String, AttributeValue> attributes);

View File

@ -42,13 +42,13 @@ final class SpanShim implements Span {
@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 @@ final class SpanShim implements Span {
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");
}