Skip to content

Commit

Permalink
re-add profiling.data.format (#1278)
Browse files Browse the repository at this point in the history
  • Loading branch information
breedx-splk authored May 17, 2023
1 parent 0e7c876 commit ff9ded9
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ public class ProfilingSemanticAttributes {
public static final AttributeKey<Long> SOURCE_EVENT_TIME = longKey("source.event.time");

public static final AttributeKey<String> DATA_TYPE = stringKey("profiling.data.type");
public static final AttributeKey<String> DATA_FORMAT = stringKey("profiling.data.format");
public static final String PPROF_GZIP_BASE64 = "pprof-gzip-base64";
public static final AttributeKey<Long> FRAME_COUNT = longKey("profiling.data.total.frame.count");

public static final AttributeKey<Long> THREAD_ID = longKey("thread.id");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@

package com.splunk.opentelemetry.profiler.exporter;

import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.DATA_FORMAT;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.DATA_TYPE;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.FRAME_COUNT;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.PPROF_GZIP_BASE64;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.PROFILING_SOURCE;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.SOURCE_TYPE;
import static java.util.logging.Level.FINE;
Expand All @@ -42,6 +44,7 @@ public PprofLogDataExporter(Logger otelLogger, ProfilingDataType dataType) {
Attributes.builder()
.put(SOURCE_TYPE, PROFILING_SOURCE)
.put(DATA_TYPE, dataType.value())
.put(DATA_FORMAT, PPROF_GZIP_BASE64)
.build();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@

import static com.splunk.opentelemetry.LogsInspector.getStringAttr;
import static com.splunk.opentelemetry.LogsInspector.hasThreadName;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.DATA_FORMAT;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.FRAME_COUNT;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.PPROF_GZIP_BASE64;
import static com.splunk.opentelemetry.profiler.ProfilingSemanticAttributes.SOURCE_TYPE;
import static org.assertj.core.api.Assertions.assertThat;
import static org.awaitility.Awaitility.await;
Expand Down Expand Up @@ -136,7 +138,8 @@ void verifyIngestedLogContent() throws Exception {
LogsInspector logs = telemetryRetriever.waitForLogs();

assertThat(logs.getLogStream())
.allMatch(log -> "otel.profiling".equals(getStringAttr(log, SOURCE_TYPE)));
.allMatch(log -> "otel.profiling".equals(getStringAttr(log, SOURCE_TYPE)))
.allMatch(log -> PPROF_GZIP_BASE64.equals(getStringAttr(log, DATA_FORMAT)));

assertThat(logs.getLogStream())
.allMatch(log -> LogsInspector.getLongAttr(log, FRAME_COUNT) > 0);
Expand Down

0 comments on commit ff9ded9

Please sign in to comment.