Skip to content

Commit

Permalink
Add SDK data classes for experimental profiling signal type.
Browse files Browse the repository at this point in the history
Changes addressing code review comments.
  • Loading branch information
jhalliday committed May 7, 2024
1 parent f84df98 commit 112796b
Showing 1 changed file with 20 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@

package io.opentelemetry.sdk.profiles.data;

import io.opentelemetry.api.internal.OtelEncodingUtils;
import io.opentelemetry.api.trace.SpanId;
import io.opentelemetry.api.trace.TraceId;
import javax.annotation.concurrent.Immutable;

/**
Expand All @@ -15,11 +18,22 @@
@Immutable
public interface LinkData {

/** A unique identifier of a trace that this linked span is part of. The ID is a 16-byte array. */
@SuppressWarnings("mutable")
byte[] getTraceId();
/**
* Returns a unique identifier of a trace that this linked span is part of as 32 character
* lowercase hex String.
*/
String getTraceId();

/** A unique identifier for the linked span. The ID is an 8-byte array. */
@SuppressWarnings("mutable")
byte[] getSpanId();
/** Returns the trace identifier as 16-byte array. */
default byte[] getTraceIdBytes() {
return OtelEncodingUtils.bytesFromBase16(getTraceId(), TraceId.getLength());
}

/** Returns a unique identifier for the linked span, as 16 character lowercase hex String. */
String getSpanId();

/** Returns a unique identifier for the linked span, as an 8-byte array. */
default byte[] getSpanIdBytes() {
return OtelEncodingUtils.bytesFromBase16(getSpanId(), SpanId.getLength());
}
}

0 comments on commit 112796b

Please sign in to comment.