Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setup OpenTelemetry exporter for FerretDB #4380

Merged
merged 38 commits into from
Jul 2, 2024
Merged
Changes from 1 commit
Commits
Show all changes
38 commits
Select commit Hold shift + click to select a range
2613fb9
wip
rumyantseva Jun 21, 2024
7f78593
wip
rumyantseva Jun 24, 2024
3ab2770
wip
rumyantseva Jun 24, 2024
1ab6d4e
wip
rumyantseva Jun 24, 2024
abcbc25
removed experimentations
rumyantseva Jun 25, 2024
c6a280c
lint
rumyantseva Jun 25, 2024
4260134
lint
rumyantseva Jun 25, 2024
76de66d
go mod
rumyantseva Jun 25, 2024
1cf86ad
lint
rumyantseva Jun 25, 2024
8b9e366
Merge branch 'main' into issue-4345-otel
Jun 25, 2024
0060035
wip
rumyantseva Jun 25, 2024
7d48cbc
Merge branch 'issue-4345-otel' of https://github.com/rumyantseva/Ferr…
rumyantseva Jun 25, 2024
2522bb3
wip
rumyantseva Jun 25, 2024
bc6a5ed
wip
rumyantseva Jun 25, 2024
6d991bf
Merge branch 'main' into issue-4345-otel
Jun 25, 2024
a2dc817
Merge branch 'main' into issue-4345-otel
Jun 26, 2024
1cabea7
wip
rumyantseva Jun 26, 2024
4df096f
wip
rumyantseva Jun 27, 2024
10ee683
wip
rumyantseva Jun 27, 2024
435cb5c
Merge branch 'main' into issue-4345-otel
Jun 27, 2024
2d2c1fa
wip
rumyantseva Jun 27, 2024
4d252a5
wip
rumyantseva Jun 27, 2024
84dbce4
wip
rumyantseva Jun 28, 2024
bfad76a
wip
rumyantseva Jun 28, 2024
1b6b9ef
current date (without integration tests)
rumyantseva Jun 28, 2024
0164d9b
typo
rumyantseva Jun 28, 2024
ad44aaa
wip
rumyantseva Jul 1, 2024
d5cc6aa
wip
rumyantseva Jul 1, 2024
0ce3546
Merge branch 'main' into issue-4345-otel
rumyantseva Jul 1, 2024
dcb098e
wip
rumyantseva Jul 1, 2024
1c0b1c9
Merge branch 'main' into pr/rumyantseva/4380
AlekSi Jul 1, 2024
bbab99f
Refactor
AlekSi Jul 1, 2024
c575e05
Refactor
AlekSi Jul 1, 2024
9b87a42
`task init`
AlekSi Jul 1, 2024
5fd1d8e
tracer should be somewhere else
rumyantseva Jul 1, 2024
e3b4664
wip
rumyantseva Jul 1, 2024
22c9399
liny
rumyantseva Jul 1, 2024
873dba7
Merge branch 'main' into issue-4345-otel
AlekSi Jul 2, 2024
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
Prev Previous commit
Next Next commit
wip
  • Loading branch information
rumyantseva committed Jul 1, 2024
commit dcb098e22290483567f7b4bb3f08a5229e205cc3
19 changes: 17 additions & 2 deletions integration/setup/startup.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@
// shutdownOtel is a function that stops OpenTelemetry's tracer provider.
var shutdownOtel context.CancelFunc

// otelDone is a channel that is closed when OpenTelemetry's tracer provider is stopped.
var otelDone = make(chan struct{})

// Startup initializes things that should be initialized only once.
func Startup() {
logging.Setup(zap.DebugLevel, "console", "")
Expand All @@ -62,10 +65,13 @@

ot, err := observability.NewOtelTracer(&otOpts)
if err != nil {
zap.S().Fatal(err)

Check warning on line 68 in integration/setup/startup.go

View check run for this annotation

Codecov / codecov/patch

integration/setup/startup.go#L68

Added line #L68 was not covered by tests
}

go ot.Run(context.TODO())
go func() {
ot.Run(context.TODO())
otelDone <- struct{}{}
}()

ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
Expand Down Expand Up @@ -133,8 +139,17 @@

// Shutdown cleans up after all tests.
func Shutdown() {
AlekSi marked this conversation as resolved.
Show resolved Hide resolved
shutdownOtel()

Check warning on line 142 in integration/setup/startup.go

View check run for this annotation

Codecov / codecov/patch

integration/setup/startup.go#L142

Added line #L142 was not covered by tests
// TODO how do we check that shutdown is complete?

t := time.NewTimer(3 * time.Second)
defer t.Stop()

Check warning on line 145 in integration/setup/startup.go

View check run for this annotation

Codecov / codecov/patch

integration/setup/startup.go#L144-L145

Added lines #L144 - L145 were not covered by tests

select {
case <-otelDone:

Check warning on line 148 in integration/setup/startup.go

View check run for this annotation

Codecov / codecov/patch

integration/setup/startup.go#L147-L148

Added lines #L147 - L148 were not covered by tests
// do nothing
case <-t.C:
zap.S().Warn("OpenTelemetry system shutdown timeout.")

Check warning on line 151 in integration/setup/startup.go

View check run for this annotation

Codecov / codecov/patch

integration/setup/startup.go#L150-L151

Added lines #L150 - L151 were not covered by tests
}

// to increase a chance of resource finalizers to spot problems
runtime.GC()
Expand Down
Loading