0
0
Fork 0
mirror of https://github.com/matrix-org/dendrite synced 2024-12-05 03:12:35 +01:00
dendrite/internal/tracing_test.go
Till 232aef016c
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.
2023-03-13 16:45:14 +01:00

25 lines
482 B
Go

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()
}