|
5 | 5 |
|
6 | 6 | package io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace;
|
7 | 7 |
|
8 |
| -import static io.opentelemetry.javaagent.instrumentation.opentelemetryapi.trace.Bridging.toAgentOrNull; |
9 |
| - |
10 | 8 | import application.io.opentelemetry.api.common.AttributeKey;
|
11 | 9 | import application.io.opentelemetry.api.common.Attributes;
|
12 | 10 | import application.io.opentelemetry.api.trace.Span;
|
13 |
| -import application.io.opentelemetry.api.trace.SpanBuilder; |
14 | 11 | import application.io.opentelemetry.api.trace.SpanContext;
|
15 |
| -import application.io.opentelemetry.api.trace.SpanKind; |
16 | 12 | import application.io.opentelemetry.api.trace.StatusCode;
|
17 |
| -import application.io.opentelemetry.context.Context; |
18 | 13 | import com.google.errorprone.annotations.CanIgnoreReturnValue;
|
19 |
| -import io.opentelemetry.javaagent.instrumentation.opentelemetryapi.context.AgentContextStorage; |
20 | 14 | import java.util.concurrent.TimeUnit;
|
21 | 15 | import javax.annotation.Nullable;
|
22 | 16 |
|
23 |
| -class ApplicationSpan implements Span { |
| 17 | +public class ApplicationSpan implements Span { |
24 | 18 |
|
25 | 19 | private final io.opentelemetry.api.trace.Span agentSpan;
|
26 | 20 |
|
27 |
| - ApplicationSpan(io.opentelemetry.api.trace.Span agentSpan) { |
| 21 | + public ApplicationSpan(io.opentelemetry.api.trace.Span agentSpan) { |
28 | 22 | this.agentSpan = agentSpan;
|
29 | 23 | }
|
30 | 24 |
|
@@ -190,103 +184,4 @@ public String toString() {
|
190 | 184 | public int hashCode() {
|
191 | 185 | return agentSpan.hashCode();
|
192 | 186 | }
|
193 |
| - |
194 |
| - static class Builder implements SpanBuilder { |
195 |
| - |
196 |
| - private final io.opentelemetry.api.trace.SpanBuilder agentBuilder; |
197 |
| - |
198 |
| - Builder(io.opentelemetry.api.trace.SpanBuilder agentBuilder) { |
199 |
| - this.agentBuilder = agentBuilder; |
200 |
| - } |
201 |
| - |
202 |
| - @Override |
203 |
| - @CanIgnoreReturnValue |
204 |
| - public SpanBuilder setParent(Context applicationContext) { |
205 |
| - agentBuilder.setParent(AgentContextStorage.getAgentContext(applicationContext)); |
206 |
| - return this; |
207 |
| - } |
208 |
| - |
209 |
| - @Override |
210 |
| - @CanIgnoreReturnValue |
211 |
| - public SpanBuilder setNoParent() { |
212 |
| - agentBuilder.setNoParent(); |
213 |
| - return this; |
214 |
| - } |
215 |
| - |
216 |
| - @Override |
217 |
| - @CanIgnoreReturnValue |
218 |
| - public SpanBuilder addLink(SpanContext applicationSpanContext) { |
219 |
| - agentBuilder.addLink(Bridging.toAgent(applicationSpanContext)); |
220 |
| - return this; |
221 |
| - } |
222 |
| - |
223 |
| - @Override |
224 |
| - @CanIgnoreReturnValue |
225 |
| - public SpanBuilder addLink( |
226 |
| - SpanContext applicationSpanContext, Attributes applicationAttributes) { |
227 |
| - agentBuilder.addLink(Bridging.toAgent(applicationSpanContext)); |
228 |
| - return this; |
229 |
| - } |
230 |
| - |
231 |
| - @Override |
232 |
| - @CanIgnoreReturnValue |
233 |
| - public SpanBuilder setAttribute(String key, String value) { |
234 |
| - agentBuilder.setAttribute(key, value); |
235 |
| - return this; |
236 |
| - } |
237 |
| - |
238 |
| - @Override |
239 |
| - @CanIgnoreReturnValue |
240 |
| - public SpanBuilder setAttribute(String key, long value) { |
241 |
| - agentBuilder.setAttribute(key, value); |
242 |
| - return this; |
243 |
| - } |
244 |
| - |
245 |
| - @Override |
246 |
| - @CanIgnoreReturnValue |
247 |
| - public SpanBuilder setAttribute(String key, double value) { |
248 |
| - agentBuilder.setAttribute(key, value); |
249 |
| - return this; |
250 |
| - } |
251 |
| - |
252 |
| - @Override |
253 |
| - @CanIgnoreReturnValue |
254 |
| - public SpanBuilder setAttribute(String key, boolean value) { |
255 |
| - agentBuilder.setAttribute(key, value); |
256 |
| - return this; |
257 |
| - } |
258 |
| - |
259 |
| - @Override |
260 |
| - @CanIgnoreReturnValue |
261 |
| - public <T> SpanBuilder setAttribute(AttributeKey<T> applicationKey, T value) { |
262 |
| - @SuppressWarnings("unchecked") |
263 |
| - io.opentelemetry.api.common.AttributeKey<T> agentKey = Bridging.toAgent(applicationKey); |
264 |
| - if (agentKey != null) { |
265 |
| - agentBuilder.setAttribute(agentKey, value); |
266 |
| - } |
267 |
| - return this; |
268 |
| - } |
269 |
| - |
270 |
| - @Override |
271 |
| - @CanIgnoreReturnValue |
272 |
| - public SpanBuilder setSpanKind(SpanKind applicationSpanKind) { |
273 |
| - io.opentelemetry.api.trace.SpanKind agentSpanKind = toAgentOrNull(applicationSpanKind); |
274 |
| - if (agentSpanKind != null) { |
275 |
| - agentBuilder.setSpanKind(agentSpanKind); |
276 |
| - } |
277 |
| - return this; |
278 |
| - } |
279 |
| - |
280 |
| - @Override |
281 |
| - @CanIgnoreReturnValue |
282 |
| - public SpanBuilder setStartTimestamp(long startTimestamp, TimeUnit unit) { |
283 |
| - agentBuilder.setStartTimestamp(startTimestamp, unit); |
284 |
| - return this; |
285 |
| - } |
286 |
| - |
287 |
| - @Override |
288 |
| - public Span startSpan() { |
289 |
| - return new ApplicationSpan(agentBuilder.startSpan()); |
290 |
| - } |
291 |
| - } |
292 | 187 | }
|
0 commit comments