1package org.openqa.selenium.remote.tracing;2import org.openqa.selenium.remote.tracing.spi.Tracer;3import java.util.Objects;4public class TraceContext {5 private final Tracer tracer;6 private final Object context;7 public TraceContext(Tracer tracer, Object context) {8 this.tracer = Objects.requireNonNull(tracer);9 this.context = Objects.requireNonNull(context);10 }11 public Object getContext() {12 return context;13 }14 public Span createSpan(String name) {15 return tracer.createSpan(name, context);16 }17 public void close() {18 tracer.close(context);19 }20}21package org.openqa.selenium.remote.tracing;22import org.openqa.selenium.remote.tracing.spi.Tracer;23import java.util.Objects;24public class Span {25 private final Tracer tracer;26 private final Object context;27 private final Object span;28 public Span(Tracer tracer, Object context, Object span) {29 this.tracer = Objects.requireNonNull(tracer);30 this.context = Objects.requireNonNull(context);31 this.span = Objects.requireNonNull(span);32 }33 public void addAttribute(String key, String value) {34 tracer.addAttribute(context, span, key, value);35 }36 public void addAttribute(String key, boolean value) {37 tracer.addAttribute(context, span, key, value);38 }39 public void addAttribute(String key, long value) {40 tracer.addAttribute(context, span, key, value);41 }42 public void addAttribute(String key, double value) {43 tracer.addAttribute(context, span, key, value);44 }45 public void addAttribute(String key, int value) {46 tracer.addAttribute(context, span, key, value);47 }48 public void addAttribute(String key, float value) {49 tracer.addAttribute(context, span, key, value);50 }51 public void addAttribute(String key, byte value) {52 tracer.addAttribute(context, span, key, value);53 }54 public void addAttribute(String key, char value) {55 tracer.addAttribute(context, span, key, value);56 }57 public void addAttribute(String key, short value) {58 tracer.addAttribute(context, span, key, value);59 }60 public void addAttribute(String key, Object value) {61 tracer.addAttribute(context, span, key, value);62 }63 public void close() {64 tracer.close(context, span);65 }66}