-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pyroscope: cleanse java syms to group frames
- Loading branch information
1 parent
b214ae3
commit 52d577d
Showing
5 changed files
with
567 additions
and
524 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package jfrparser | ||
|
||
import ( | ||
"regexp" | ||
|
||
"github.com/grafana/jfr-parser/parser/types" | ||
) | ||
|
||
// reference: https://github.com/grafana/jfr-parser/blob/main/pprof/symbols.go | ||
|
||
var ( | ||
// jdk/internal/reflect/GeneratedMethodAccessor31 | ||
generatedMethodAccessor = regexp.MustCompile(`^(jdk/internal/reflect/GeneratedMethodAccessor)(\d+)$`) | ||
|
||
// org/example/rideshare/OrderService$$Lambda$669.0x0000000800fd7318.run | ||
// Fib$$Lambda.0x00007ffa600c4da0.run | ||
lambda = regexp.MustCompile(`^(.+\$\$Lambda)(\$?\d*[./](0x)?[\da-f]+|\d+)$`) | ||
|
||
// libzstd-jni-1.5.1-16931311898282279136.so.Java_com_github_luben_zstd_ZstdInputStreamNoFinalizer_decompressStream | ||
libzstd = regexp.MustCompile(`^(\.?/tmp/)?(libzstd-jni-\d+\.\d+\.\d+-)(\d+)(\.so)( \(deleted\))?$`) | ||
|
||
// ./tmp/libamazonCorrettoCryptoProvider109b39cf33c563eb.so | ||
// ./tmp/amazonCorrettoCryptoProviderNativeLibraries.7382c2f79097f415/libcrypto.so (deleted) | ||
libcrypto = regexp.MustCompile(`^(\.?/tmp/)?(lib)?(amazonCorrettoCryptoProvider)(NativeLibraries\.)?([0-9a-f]{16})(/libcrypto|/libamazonCorrettoCryptoProvider)?(\.so)( \(deleted\))?$`) | ||
|
||
// libasyncProfiler-linux-arm64-17b9a1d8156277a98ccc871afa9a8f69215f92.so | ||
libasyncProfiler = regexp.MustCompile(`^(\.?/tmp/)?(libasyncProfiler)-(linux-arm64|linux-musl-x64|linux-x64|macos)-(17b9a1d8156277a98ccc871afa9a8f69215f92)(\.so)( \(deleted\))?$`) | ||
|
||
// TODO: ./tmp/snappy-1.1.8-6fb9393a-3093-4706-a7e4-837efe01d078-libsnappyjava.so | ||
) | ||
|
||
func cleanse(frame string) string { | ||
frame = generatedMethodAccessor.ReplaceAllString(frame, "${1}_") | ||
frame = lambda.ReplaceAllString(frame, "${1}_") | ||
frame = libzstd.ReplaceAllString(frame, "libzstd-jni-_.so") | ||
frame = libcrypto.ReplaceAllString(frame, "libamazonCorrettoCryptoProvider_.so") | ||
frame = libasyncProfiler.ReplaceAllString(frame, "libasyncProfiler-_.so") | ||
return frame | ||
} | ||
|
||
func processSyms(ref *types.SymbolList) { | ||
for i := range ref.Symbol { | ||
ref.Symbol[i].String = cleanse(ref.Symbol[i].String) | ||
} | ||
} |
2 changes: 1 addition & 1 deletion
2
receiver/pyroscopereceiver/testdata/cortex-dev-01__kafka-0__cpu__0.pb
Large diffs are not rendered by default.
Oops, something went wrong.
519 changes: 260 additions & 259 deletions
519
receiver/pyroscopereceiver/testdata/memory_example_alloc_in_new_tlab.pb
Large diffs are not rendered by default.
Oops, something went wrong.
521 changes: 260 additions & 261 deletions
521
receiver/pyroscopereceiver/testdata/memory_example_live_object.pb
Large diffs are not rendered by default.
Oops, something went wrong.