From cefc6befc0a41a075e488739ddbdc635e0c93114 Mon Sep 17 00:00:00 2001 From: tomershafir Date: Sun, 11 Feb 2024 13:19:32 +0200 Subject: [PATCH] fix thread state parser for async-profiler 3.0 --- exporter/clickhouseprofileexporter/ch/access_native_columnar.go | 1 + receiver/pyroscopereceiver/jfrparser/parser.go | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/exporter/clickhouseprofileexporter/ch/access_native_columnar.go b/exporter/clickhouseprofileexporter/ch/access_native_columnar.go index dcdb7c5..e600241 100644 --- a/exporter/clickhouseprofileexporter/ch/access_native_columnar.go +++ b/exporter/clickhouseprofileexporter/ch/access_native_columnar.go @@ -171,6 +171,7 @@ func (ch *clickhouseAccessNativeColumnar) InsertBatch(ls plog.Logs) error { zap.String(columnServiceName, service_name[i]), zap.String(columnPeriodType, period_type[i]), zap.String(columnPeriodUnit, period_unit[i]), + zap.Any(columnSampleTypesUnits, sample_types_units[i]), zap.String(columnPayloadType, payload_type[i]), ) } diff --git a/receiver/pyroscopereceiver/jfrparser/parser.go b/receiver/pyroscopereceiver/jfrparser/parser.go index c0d2eb4..3bf3c90 100644 --- a/receiver/pyroscopereceiver/jfrparser/parser.go +++ b/receiver/pyroscopereceiver/jfrparser/parser.go @@ -81,7 +81,7 @@ func (pa *jfrPprofParser) Parse(jfr *bytes.Buffer, md profile_types.Metadata) ([ case pa.jfrParser.TypeMap.T_EXECUTION_SAMPLE: values[0] = 1 * int64(period) ts := pa.jfrParser.GetThreadState(pa.jfrParser.ExecutionSample.State) - if ts != nil && ts.Name == "STATE_RUNNABLE" { + if ts != nil && ts.Name != "STATE_SLEEPING" { pa.addStacktrace(sampleTypeCpu, pa.jfrParser.ExecutionSample.StackTrace, values[:1]) } // TODO: this code is from github/grafana/pyroscope, need to validate that the qryn.js query simulator handles this branch as expected for wall