Add basic runtime tracing (#2996)

This allows us in almost all places to use regions to further trace down
long running tasks.
Also removes an unused function.
This commit is contained in:
Till 2023-03-13 16:45:14 +01:00 committed by GitHub
parent 689b5ee72f
commit 232aef016c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 190 additions and 155 deletions

25
internal/tracing_test.go Normal file
View file

@ -0,0 +1,25 @@
package internal
import (
"context"
"testing"
"github.com/stretchr/testify/assert"
)
func TestTracing(t *testing.T) {
inCtx := context.Background()
task, ctx := StartTask(inCtx, "testing")
assert.NotNil(t, ctx)
assert.NotNil(t, task)
assert.NotEqual(t, inCtx, ctx)
task.SetTag("key", "value")
region, ctx2 := StartRegion(ctx, "testing")
assert.NotNil(t, ctx)
assert.NotNil(t, region)
assert.NotEqual(t, ctx, ctx2)
defer task.EndTask()
defer region.EndRegion()
}