Skip to content

Commit 72f7302

Browse files
committed
Initial commit
0 parents  commit 72f7302

File tree

8 files changed

+521
-0
lines changed

8 files changed

+521
-0
lines changed

.gitignore

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# Created by https://www.toptal.com/developers/gitignore/api/macos,linux,windows,go,goland+all,visualstudiocode
2+
# Edit at https://www.toptal.com/developers/gitignore?templates=macos,linux,windows,go,goland+all,visualstudiocode
3+
4+
### Go ###
5+
# If you prefer the allow list template instead of the deny list, see community template:
6+
# https://github.com/github/gitignore/blob/main/community/Golang/Go.AllowList.gitignore
7+
#
8+
# Binaries for programs and plugins
9+
*.exe
10+
*.exe~
11+
*.dll
12+
*.so
13+
*.dylib
14+
15+
# Test binary, built with `go test -c`
16+
*.test
17+
18+
# Output of the go coverage tool, specifically when used with LiteIDE
19+
*.out
20+
21+
# Dependency directories (remove the comment below to include it)
22+
# vendor/
23+
24+
# Go workspace file
25+
go.work
26+
27+
### Go Patch ###
28+
/vendor/
29+
/Godeps/
30+
31+
### GoLand+all ###
32+
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
33+
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
34+
35+
# User-specific stuff
36+
.idea/**/workspace.xml
37+
.idea/**/tasks.xml
38+
.idea/**/usage.statistics.xml
39+
.idea/**/dictionaries
40+
.idea/**/shelf
41+
42+
# AWS User-specific
43+
.idea/**/aws.xml
44+
45+
# Generated files
46+
.idea/**/contentModel.xml
47+
48+
# Sensitive or high-churn files
49+
.idea/**/dataSources/
50+
.idea/**/dataSources.ids
51+
.idea/**/dataSources.local.xml
52+
.idea/**/sqlDataSources.xml
53+
.idea/**/dynamic.xml
54+
.idea/**/uiDesigner.xml
55+
.idea/**/dbnavigator.xml
56+
57+
# Gradle
58+
.idea/**/gradle.xml
59+
.idea/**/libraries
60+
61+
# Gradle and Maven with auto-import
62+
# When using Gradle or Maven with auto-import, you should exclude module files,
63+
# since they will be recreated, and may cause churn. Uncomment if using
64+
# auto-import.
65+
# .idea/artifacts
66+
# .idea/compiler.xml
67+
# .idea/jarRepositories.xml
68+
# .idea/modules.xml
69+
# .idea/*.iml
70+
# .idea/modules
71+
# *.iml
72+
# *.ipr
73+
74+
# CMake
75+
cmake-build-*/
76+
77+
# Mongo Explorer plugin
78+
.idea/**/mongoSettings.xml
79+
80+
# File-based project format
81+
*.iws
82+
83+
# IntelliJ
84+
out/
85+
86+
# mpeltonen/sbt-idea plugin
87+
.idea_modules/
88+
89+
# JIRA plugin
90+
atlassian-ide-plugin.xml
91+
92+
# Cursive Clojure plugin
93+
.idea/replstate.xml
94+
95+
# SonarLint plugin
96+
.idea/sonarlint/
97+
98+
# Crashlytics plugin (for Android Studio and IntelliJ)
99+
com_crashlytics_export_strings.xml
100+
crashlytics.properties
101+
crashlytics-build.properties
102+
fabric.properties
103+
104+
# Editor-based Rest Client
105+
.idea/httpRequests
106+
107+
# Android studio 3.1+ serialized cache file
108+
.idea/caches/build_file_checksums.ser
109+
110+
### GoLand+all Patch ###
111+
# Ignore everything but code style settings and run configurations
112+
# that are supposed to be shared within teams.
113+
114+
.idea/*
115+
116+
!.idea/codeStyles
117+
!.idea/runConfigurations
118+
119+
### Linux ###
120+
*~
121+
122+
# temporary files which can be created if a process still has a handle open of a deleted file
123+
.fuse_hidden*
124+
125+
# KDE directory preferences
126+
.directory
127+
128+
# Linux trash folder which might appear on any partition or disk
129+
.Trash-*
130+
131+
# .nfs files are created when an open file is removed but is still being accessed
132+
.nfs*
133+
134+
### macOS ###
135+
# General
136+
.DS_Store
137+
.AppleDouble
138+
.LSOverride
139+
140+
# Icon must end with two \r
141+
Icon
142+
143+
144+
# Thumbnails
145+
._*
146+
147+
# Files that might appear in the root of a volume
148+
.DocumentRevisions-V100
149+
.fseventsd
150+
.Spotlight-V100
151+
.TemporaryItems
152+
.Trashes
153+
.VolumeIcon.icns
154+
.com.apple.timemachine.donotpresent
155+
156+
# Directories potentially created on remote AFP share
157+
.AppleDB
158+
.AppleDesktop
159+
Network Trash Folder
160+
Temporary Items
161+
.apdisk
162+
163+
### macOS Patch ###
164+
# iCloud generated files
165+
*.icloud
166+
167+
### VisualStudioCode ###
168+
.vscode/*
169+
!.vscode/settings.json
170+
!.vscode/tasks.json
171+
!.vscode/launch.json
172+
!.vscode/extensions.json
173+
!.vscode/*.code-snippets
174+
175+
# Local History for Visual Studio Code
176+
.history/
177+
178+
# Built Visual Studio Code Extensions
179+
*.vsix
180+
181+
### VisualStudioCode Patch ###
182+
# Ignore all local history of files
183+
.history
184+
.ionide
185+
186+
# Support for Project snippet scope
187+
.vscode/*.code-snippets
188+
189+
# Ignore code-workspaces
190+
*.code-workspace
191+
192+
### Windows ###
193+
# Windows thumbnail cache files
194+
Thumbs.db
195+
Thumbs.db:encryptable
196+
ehthumbs.db
197+
ehthumbs_vista.db
198+
199+
# Dump file
200+
*.stackdump
201+
202+
# Folder config file
203+
[Dd]esktop.ini
204+
205+
# Recycle Bin used on file shares
206+
$RECYCLE.BIN/
207+
208+
# Windows Installer files
209+
*.cab
210+
*.msi
211+
*.msix
212+
*.msm
213+
*.msp
214+
215+
# Windows shortcuts
216+
*.lnk
217+
218+
# End of https://www.toptal.com/developers/gitignore/api/macos,linux,windows,go,goland+all,visualstudiocode

config.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
package opentelemetry_stacktrace_processor
2+
3+
type Config struct{}

config_test.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package opentelemetry_stacktrace_processor
2+
3+
import (
4+
"github.com/stretchr/testify/assert"
5+
"go.opentelemetry.io/collector/component"
6+
"go.opentelemetry.io/collector/confmap"
7+
"testing"
8+
)
9+
10+
func TestUnmarshalDefaultConfig(t *testing.T) {
11+
factory := NewFactory()
12+
cfg := factory.CreateDefaultConfig()
13+
assert.NoError(t, component.UnmarshalConfig(confmap.New(), cfg))
14+
assert.Equal(t, factory.CreateDefaultConfig(), cfg)
15+
}

factory.go

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
package opentelemetry_stacktrace_processor // import "github.com/joostlek/opentelemetry-stacktrace-processor"
2+
import (
3+
"context"
4+
"go.opentelemetry.io/collector/component"
5+
"go.opentelemetry.io/collector/consumer"
6+
"go.opentelemetry.io/collector/processor"
7+
)
8+
9+
const typeStr = "stacktrace"
10+
11+
func NewFactory() processor.Factory {
12+
return processor.NewFactory(
13+
typeStr,
14+
createDefaultConfig,
15+
processor.WithTraces(createTraces, component.StabilityLevelStable),
16+
)
17+
}
18+
19+
func createDefaultConfig() component.Config {
20+
return &Config{}
21+
}
22+
23+
func createTraces(
24+
_ context.Context,
25+
set processor.CreateSettings,
26+
cfg component.Config,
27+
nextConsumer consumer.Traces,
28+
) (processor.Traces, error) {
29+
return newStackTraceProcessor(set, nextConsumer, cfg.(*Config))
30+
}

factory_test.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
package opentelemetry_stacktrace_processor
2+
3+
import (
4+
"context"
5+
"testing"
6+
7+
"github.com/stretchr/testify/assert"
8+
9+
"go.opentelemetry.io/collector/component/componenttest"
10+
"go.opentelemetry.io/collector/processor/processortest"
11+
)
12+
13+
func TestCreateDefaultConfig(t *testing.T) {
14+
factory := NewFactory()
15+
16+
cfg := factory.CreateDefaultConfig()
17+
assert.NotNil(t, cfg, "failed to create default config")
18+
assert.NoError(t, componenttest.CheckConfigStruct(cfg))
19+
}
20+
21+
func TestCreateProcessor(t *testing.T) {
22+
factory := NewFactory()
23+
24+
cfg := factory.CreateDefaultConfig()
25+
creationSet := processortest.NewNopCreateSettings()
26+
tp, err := factory.CreateTracesProcessor(context.Background(), creationSet, cfg, nil)
27+
assert.NotNil(t, tp)
28+
assert.NoError(t, err, "cannot create trace processor")
29+
}

go.mod

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
module github.com/joostlek/opentelemetry-stacktrace-processor
2+
3+
go 1.19
4+
5+
require (
6+
github.com/stretchr/testify v1.8.2
7+
go.opentelemetry.io/collector v0.78.1
8+
go.opentelemetry.io/collector/component v0.78.1
9+
go.opentelemetry.io/collector/confmap v0.78.1
10+
go.opentelemetry.io/collector/consumer v0.78.1
11+
go.opentelemetry.io/collector/pdata v1.0.0-rcv0012
12+
)
13+
14+
require (
15+
github.com/davecgh/go-spew v1.1.1 // indirect
16+
github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect
17+
github.com/gogo/protobuf v1.3.2 // indirect
18+
github.com/golang/protobuf v1.5.3 // indirect
19+
github.com/json-iterator/go v1.1.12 // indirect
20+
github.com/knadh/koanf v1.5.0 // indirect
21+
github.com/mitchellh/copystructure v1.2.0 // indirect
22+
github.com/mitchellh/mapstructure v1.5.0 // indirect
23+
github.com/mitchellh/reflectwalk v1.0.2 // indirect
24+
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
25+
github.com/modern-go/reflect2 v1.0.2 // indirect
26+
github.com/pmezard/go-difflib v1.0.0 // indirect
27+
go.opentelemetry.io/collector/featuregate v1.0.0-rcv0012 // indirect
28+
go.opentelemetry.io/otel v1.15.1 // indirect
29+
go.opentelemetry.io/otel/metric v0.38.1 // indirect
30+
go.opentelemetry.io/otel/trace v1.15.1 // indirect
31+
go.uber.org/atomic v1.10.0 // indirect
32+
go.uber.org/multierr v1.11.0 // indirect
33+
go.uber.org/zap v1.24.0 // indirect
34+
golang.org/x/net v0.10.0 // indirect
35+
golang.org/x/sys v0.8.0 // indirect
36+
golang.org/x/text v0.9.0 // indirect
37+
google.golang.org/genproto v0.0.0-20230410155749-daa745c078e1 // indirect
38+
google.golang.org/grpc v1.55.0 // indirect
39+
google.golang.org/protobuf v1.30.0 // indirect
40+
gopkg.in/yaml.v3 v3.0.1 // indirect
41+
)

0 commit comments

Comments
 (0)