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

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

Merged
merged 1 commit into from
Apr 4, 2019
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
4 changes: 2 additions & 2 deletions api/src/main/java/openconsensus/trace/BlankSpan.java
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
8 changes: 4 additions & 4 deletions api/src/main/java/openconsensus/trace/Span.java
Original file line number Diff line number Diff line change
Expand Up @@ -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}.
Expand All @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,23 @@ 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;
}

@Override
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");
}
Expand Down