mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 12:52:24 +03:00
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:
parent
689b5ee72f
commit
232aef016c
10 changed files with 190 additions and 155 deletions
25
internal/tracing_test.go
Normal file
25
internal/tracing_test.go
Normal 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()
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue