Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import com.google.auto.value.AutoValue;
import io.opentelemetry.exporter.otlp.profiles.ProfileData;
import io.opentelemetry.exporter.otlp.profiles.ProfileDictionaryData;
import io.opentelemetry.exporter.otlp.profiles.ProfilesDictionaryData;
import io.opentelemetry.exporter.otlp.profiles.SampleData;
import io.opentelemetry.exporter.otlp.profiles.ValueTypeData;
import io.opentelemetry.sdk.common.InstrumentationScopeInfo;
Expand Down Expand Up @@ -36,35 +36,33 @@ public abstract class ImmutableProfileData implements ProfileData {
public static ProfileData create(
Comment thread
jhalliday marked this conversation as resolved.
Resource resource,
InstrumentationScopeInfo instrumentationScopeInfo,
ProfileDictionaryData profileDictionaryData,
ProfilesDictionaryData profilesDictionaryData,
ValueTypeData sampleType,
List<SampleData> samples,
long timeNanos,
long durationNanos,
ValueTypeData periodType,
long period,
List<Integer> commentStrIndices,
String profileId,
List<Integer> attributeIndices,
int droppedAttributesCount,
String originalPayloadFormat,
ByteBuffer originalPayload) {
ByteBuffer originalPayload,
List<Integer> attributeIndices) {
return new AutoValue_ImmutableProfileData(
resource,
instrumentationScopeInfo,
profileDictionaryData,
profilesDictionaryData,
sampleType,
samples,
timeNanos,
durationNanos,
periodType,
period,
commentStrIndices,
profileId,
attributeIndices,
droppedAttributesCount,
originalPayloadFormat,
originalPayload);
originalPayload,
attributeIndices);
}

ImmutableProfileData() {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,37 +11,37 @@
import io.opentelemetry.exporter.otlp.profiles.LinkData;
import io.opentelemetry.exporter.otlp.profiles.LocationData;
import io.opentelemetry.exporter.otlp.profiles.MappingData;
import io.opentelemetry.exporter.otlp.profiles.ProfileDictionaryData;
import io.opentelemetry.exporter.otlp.profiles.ProfilesDictionaryData;
import io.opentelemetry.exporter.otlp.profiles.StackData;
import java.util.List;
import javax.annotation.concurrent.Immutable;

/**
* Auto value implementation of {@link ProfileDictionaryData}, which represents profiles data shared
* across the entire message being sent.
* Auto value implementation of {@link ProfilesDictionaryData}, which represents profiles data
* shared across the entire message being sent.
*
* <p>This class is internal and is hence not for public use. Its APIs are unstable and can change
* at any time.
*/
@Immutable
@AutoValue
public abstract class ImmutableProfileDictionaryData implements ProfileDictionaryData {
public abstract class ImmutableProfilesDictionaryData implements ProfilesDictionaryData {

/**
* Returns a new ProfileData representing the given data.
*
* @return a new ProfileData representing the given data.
*/
@SuppressWarnings("TooManyParameters")
public static ProfileDictionaryData create(
public static ProfilesDictionaryData create(
List<MappingData> mappingTable,
List<LocationData> locationTable,
List<FunctionData> functionTable,
List<LinkData> linkTable,
List<String> stringTable,
List<KeyValueAndUnitData> attributeTable,
List<StackData> stackTable) {
return new AutoValue_ImmutableProfileDictionaryData(
return new AutoValue_ImmutableProfilesDictionaryData(
mappingTable,
locationTable,
functionTable,
Expand All @@ -51,5 +51,5 @@ public static ProfileDictionaryData create(
stackTable);
}

ImmutableProfileDictionaryData() {}
ImmutableProfilesDictionaryData() {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ public abstract class ImmutableSampleData implements SampleData {
*/
public static SampleData create(
int stackIndex,
List<Long> values,
List<Integer> attributeIndices,
int linkIndex,
List<Long> values,
List<Long> timestamps) {
return new AutoValue_ImmutableSampleData(
stackIndex, values, attributeIndices, linkIndex, timestamps);
stackIndex, attributeIndices, linkIndex, values, timestamps);
}

ImmutableSampleData() {}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public interface ProfileData {
InstrumentationScopeInfo getInstrumentationScopeInfo();

/** Returns the dictionary data of this profile. */
ProfileDictionaryData getProfileDictionaryData();
ProfilesDictionaryData getProfileDictionaryData();

/** A description of the type associated with each Sample.value. */
ValueTypeData getSampleType();
Expand All @@ -51,9 +51,6 @@ public interface ProfileData {
/** The number of events between sampled occurrences. */
long getPeriod();

/** Free-form text associated with the profile. Indices into string table. */
List<Integer> getCommentStrIndices();
Comment thread
jhalliday marked this conversation as resolved.

/**
* Returns a globally unique identifier for a profile, as 32 character lowercase hex String. An ID
* with all zeroes is considered invalid. This field is required.
Expand All @@ -68,15 +65,6 @@ default byte[] getProfileIdBytes() {
return OtelEncodingUtils.bytesFromBase16(getProfileId(), 32);
}

/**
* Returns indexes of profile-wide attributes, referencing to Profile.attribute_table. Attribute
* keys MUST be unique (it is not allowed to have more than one attribute with the same key).
*
* @see
* "https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute"
*/
List<Integer> getAttributeIndices();

/**
* Returns the total number of attributes that were recorded on this profile.
*
Expand All @@ -98,4 +86,13 @@ default byte[] getProfileIdBytes() {
* SHOULD not be included in this field.
*/
ByteBuffer getOriginalPayload();

/**
* Returns indexes of profile-wide attributes, referencing to Profile.attribute_table. Attribute
* keys MUST be unique (it is not allowed to have more than one attribute with the same key).
*
* @see
* "https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/common/README.md#attribute"
*/
List<Integer> getAttributeIndices();
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@ final class ProfileMarshaler extends MarshalerWithSize {
private final ValueTypeMarshaler periodTypeMarshaler;
private final long period;
private final byte[] profileId;
private final List<Integer> attributeIndices;
private final int droppedAttributesCount;
private final byte[] originalPayloadFormatUtf8;
private final ByteBuffer originalPayload;
private final List<Integer> attributeIndices;

static ProfileMarshaler create(ProfileData profileData) {

Expand All @@ -44,10 +44,10 @@ static ProfileMarshaler create(ProfileData profileData) {
periodTypeMarshaler,
profileData.getPeriod(),
profileData.getProfileIdBytes(),
profileData.getAttributeIndices(),
droppedAttributesCount,
MarshalerUtil.toBytes(profileData.getOriginalPayloadFormat()),
profileData.getOriginalPayload());
profileData.getOriginalPayload(),
profileData.getAttributeIndices());
}

private ProfileMarshaler(
Expand All @@ -58,10 +58,10 @@ private ProfileMarshaler(
ValueTypeMarshaler periodTypeMarshaler,
long period,
byte[] profileId,
List<Integer> attributeIndices,
int droppedAttributesCount,
byte[] originalPayloadFormat,
ByteBuffer originalPayload) {
ByteBuffer originalPayload,
List<Integer> attributeIndices) {
super(
calculateSize(
sampleTypeMarshaler,
Expand All @@ -71,10 +71,10 @@ private ProfileMarshaler(
periodTypeMarshaler,
period,
profileId,
attributeIndices,
droppedAttributesCount,
originalPayloadFormat,
originalPayload));
originalPayload,
attributeIndices));
this.sampleTypeMarshaler = sampleTypeMarshaler;
this.sampleMarshalers = sampleMarshalers;
this.timeNanos = timeNanos;
Expand All @@ -98,10 +98,10 @@ protected void writeTo(Serializer output) throws IOException {
output.serializeInt64(Profile.PERIOD, period);

output.serializeBytes(Profile.PROFILE_ID, profileId);
output.serializeRepeatedInt32(Profile.ATTRIBUTE_INDICES, attributeIndices);
output.serializeUInt32(Profile.DROPPED_ATTRIBUTES_COUNT, droppedAttributesCount);
output.serializeString(Profile.ORIGINAL_PAYLOAD_FORMAT, originalPayloadFormatUtf8);
output.serializeByteBuffer(Profile.ORIGINAL_PAYLOAD, originalPayload);
output.serializeRepeatedInt32(Profile.ATTRIBUTE_INDICES, attributeIndices);
}

private static int calculateSize(
Expand All @@ -112,10 +112,10 @@ private static int calculateSize(
ValueTypeMarshaler periodTypeMarshaler,
long period,
byte[] profileId,
List<Integer> attributeIndices,
int droppedAttributesCount,
byte[] originalPayloadFormat,
ByteBuffer originalPayload) {
ByteBuffer originalPayload,
List<Integer> attributeIndices) {
int size;
size = 0;
size += MarshalerUtil.sizeMessage(Profile.SAMPLE_TYPE, sampleTypeMarshaler);
Expand All @@ -126,10 +126,10 @@ private static int calculateSize(
size += MarshalerUtil.sizeInt64(Profile.PERIOD, period);

size += MarshalerUtil.sizeBytes(Profile.PROFILE_ID, profileId);
size += MarshalerUtil.sizeRepeatedInt32(Profile.ATTRIBUTE_INDICES, attributeIndices);
size += MarshalerUtil.sizeInt32(Profile.DROPPED_ATTRIBUTES_COUNT, droppedAttributesCount);
size += MarshalerUtil.sizeBytes(Profile.ORIGINAL_PAYLOAD_FORMAT, originalPayloadFormat);
size += MarshalerUtil.sizeByteBuffer(Profile.ORIGINAL_PAYLOAD, originalPayload);
size += MarshalerUtil.sizeRepeatedInt32(Profile.ATTRIBUTE_INDICES, attributeIndices);

return size;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@
import io.opentelemetry.exporter.otlp.internal.data.ImmutableLinkData;
import io.opentelemetry.exporter.otlp.internal.data.ImmutableLocationData;
import io.opentelemetry.exporter.otlp.internal.data.ImmutableMappingData;
import io.opentelemetry.exporter.otlp.internal.data.ImmutableProfileDictionaryData;
import io.opentelemetry.exporter.otlp.internal.data.ImmutableProfilesDictionaryData;
import io.opentelemetry.exporter.otlp.internal.data.ImmutableStackData;
import java.util.Collections;

/**
* This class allows for the assembly of the reference tables which form a ProfileDictionaryData.
* This class allows for the assembly of the reference tables which form a ProfilesDictionaryData.
*
* <p>It's effectively a builder, though without the fluent API. Instead, mutation methods return
* the index of the offered element, this information being required to construct any element that
Expand All @@ -27,7 +27,7 @@
*
* <p>This class is not threadsafe and must be externally synchronized.
*/
public class ProfileDictionaryCompositor {
public class ProfilesDictionaryCompositor {

// This implementation relies on the *Data interface impls having equals/hashCode that works.
// The provided AutoValue_* ones do, but it's potentially fragile if used externally.
Expand All @@ -40,7 +40,7 @@ public class ProfileDictionaryCompositor {
private final DictionaryTable<KeyValueAndUnitData> attributeTable = new DictionaryTable<>();
private final DictionaryTable<StackData> stackTable = new DictionaryTable<>();

public ProfileDictionaryCompositor() {
public ProfilesDictionaryCompositor() {

// The [0] element of each table should be a 'null' element, such that a 0 value pointer can be
// used to indicate null / not set, in preference to requiring an 'optional' modifier on the
Expand Down Expand Up @@ -68,8 +68,8 @@ public ProfileDictionaryCompositor() {
*
* @return a ProfileDictionaryData with the contents of the tables.
*/
public ProfileDictionaryData getProfileDictionaryData() {
return ImmutableProfileDictionaryData.create(
public ProfilesDictionaryData getProfileDictionaryData() {
return ImmutableProfilesDictionaryData.create(
mappingTable.getTable(),
locationTable.getTable(),
functionTable.getTable(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
* @see "profiles.proto::ProfilesDictionary"
*/
@Immutable
public interface ProfileDictionaryData {
public interface ProfilesDictionaryData {

/**
* Mapping from address ranges to the image/binary/library mapped into that address range.
Expand Down
Loading
Loading