feat: make trace provider in loadtest, add tracing to sdk (#4939)

This commit is contained in:
Dean Sheather
2022-11-09 08:10:48 +10:00
committed by GitHub
parent fa844d0878
commit d82364b9b5
24 changed files with 757 additions and 206 deletions

View File

@ -2,11 +2,14 @@ package codersdk
import (
"bufio"
"context"
"fmt"
"io"
"strings"
"golang.org/x/xerrors"
"github.com/coder/coder/coderd/tracing"
)
type ServerSentEvent struct {
@ -22,7 +25,10 @@ const (
ServerSentEventTypeError ServerSentEventType = "error"
)
func ServerSentEventReader(rc io.ReadCloser) func() (*ServerSentEvent, error) {
func ServerSentEventReader(ctx context.Context, rc io.ReadCloser) func() (*ServerSentEvent, error) {
_, span := tracing.StartSpan(ctx)
defer span.End()
reader := bufio.NewReader(rc)
nextLineValue := func(prefix string) ([]byte, error) {
var (