All Downloads are FREE. Search and download functionalities are using the official Maven repository.

dev.vality.woody.api.trace.ContextSpan Maven / Gradle / Ivy

There is a newer version: 2.0.8
Show newest version
package dev.vality.woody.api.trace;

import io.opentelemetry.api.trace.SpanKind;
import io.opentelemetry.api.trace.Tracer;
import io.opentelemetry.api.OpenTelemetry;

public class ContextSpan {

    protected final Span span;
    protected final Metadata metadata;
    protected final Metadata customMetadata;

    public ContextSpan() {
        span = new Span();
        metadata = new Metadata();
        customMetadata = new Metadata(false);
    }

    protected ContextSpan(ContextSpan oldSpan) {
        this.span = oldSpan.span.cloneObject();
        this.metadata = oldSpan.metadata.cloneObject();
        this.customMetadata = oldSpan.customMetadata.cloneObject();
    }

    protected ContextSpan(ContextSpan oldSpan, Metadata customMetadata) {
        this.span = oldSpan.span.cloneObject();
        this.metadata = oldSpan.metadata.cloneObject();
        this.customMetadata = customMetadata.cloneObject();
    }

    public Span getSpan() {
        return span;
    }

    public Metadata getMetadata() {
        return metadata;
    }

    public Metadata getCustomMetadata() {
        return customMetadata;
    }

    public boolean isFilled() {
        return span.isFilled();
    }

    public boolean isStarted() {
        return span.isStarted();
    }

    public void reset() {
        span.reset();
        metadata.reset();
        customMetadata.reset();
    }

    public ContextSpan cloneObject() {
        return new ContextSpan(this);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy