Merge pull request #28 from rwinch/millispan-getannotations

Add MilliSpan.getAnnotations()
This commit is contained in:
Spencer Gibb
2015-08-18 11:00:07 -06:00
2 changed files with 41 additions and 0 deletions

View File

@@ -17,6 +17,7 @@
package org.springframework.cloud.sleuth;
import java.util.ArrayList;
import java.util.Collections;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
@@ -104,4 +105,9 @@ public class MilliSpan implements Span {
msg));
}
@Override
public Map<String, String> getAnnotations() {
return Collections.unmodifiableMap(kVAnnotations);
}
}

View File

@@ -0,0 +1,35 @@
/*
* Copyright 2013-2015 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.cloud.sleuth;
import java.util.Collections;
import org.junit.Test;
/**
* @author Rob Winch
*/
public class MilliSpanTests {
@Test(expected = UnsupportedOperationException.class)
public void getAnnotationsReadOnly() {
MilliSpan span = new MilliSpan(1, 2, "name", "traceId", Collections.<String>emptyList(), "spanId", true, "processId");
span.getAnnotations().put("a", "b");
}
}