rework list courses page to be flatten
This commit is contained in:
@ -1,6 +1,38 @@
|
||||
package config
|
||||
|
||||
type Trace struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
LicenseKey string `json:"license_key"`
|
||||
import "errors"
|
||||
|
||||
type TraceClientType uint8
|
||||
|
||||
const (
|
||||
TraceClientTypeUnset TraceClientType = iota
|
||||
TraceClientTypeHTTP
|
||||
TraceClientTypeGRPC
|
||||
TraceClientTypeStdout
|
||||
)
|
||||
|
||||
func (t *TraceClientType) UnmarshalText(data []byte) error {
|
||||
dataStr := string(data)
|
||||
switch dataStr {
|
||||
case "http":
|
||||
*t = TraceClientTypeHTTP
|
||||
case "grpc":
|
||||
*t = TraceClientTypeGRPC
|
||||
case "stdout":
|
||||
*t = TraceClientTypeStdout
|
||||
case "":
|
||||
default:
|
||||
return errors.New("unsupported value " + dataStr)
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
type Trace struct {
|
||||
Endpoint string `json:"endpoint"`
|
||||
APIKey string `json:"api_key"`
|
||||
APIHeader string `json:"api_header"`
|
||||
Type TraceClientType `json:"type"`
|
||||
|
||||
ShowMetrics bool `json:"show_metrics"`
|
||||
}
|
||||
|
||||
@ -16,11 +16,10 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
commandAttribute = attribute.Key("command_name")
|
||||
queryAttribute = attribute.Key("query_name")
|
||||
argsAttribute = attribute.Key("args")
|
||||
nameAttribute = attribute.Key("cq.name")
|
||||
argsAttribute = attribute.Key("cq.args")
|
||||
|
||||
apiTracer = otel.Tracer("cq")
|
||||
apiTracer = otel.Tracer("api")
|
||||
)
|
||||
|
||||
type commandLoggingDecorator[T any] struct {
|
||||
@ -37,9 +36,9 @@ func (c commandLoggingDecorator[T]) Handle(ctx context.Context, cmd T) (err erro
|
||||
_ = json.NewEncoder(&argsBuilder).Encode(cmd)
|
||||
|
||||
var span trace.Span
|
||||
ctx, span = apiTracer.Start(ctx, handlerName)
|
||||
ctx, span = apiTracer.Start(ctx, "command "+handlerName)
|
||||
span.SetAttributes(
|
||||
commandAttribute.String(handlerName),
|
||||
nameAttribute.String(handlerName),
|
||||
argsAttribute.String(argsBuilder.String()),
|
||||
)
|
||||
|
||||
@ -73,9 +72,9 @@ func (q queryLoggingDecorator[Q, U]) Handle(ctx context.Context, query Q) (entit
|
||||
_ = json.NewEncoder(&argsBuilder).Encode(query)
|
||||
|
||||
var span trace.Span
|
||||
ctx, span = apiTracer.Start(ctx, handlerName)
|
||||
ctx, span = apiTracer.Start(ctx, "query "+handlerName)
|
||||
span.SetAttributes(
|
||||
queryAttribute.String(handlerName),
|
||||
nameAttribute.String(handlerName),
|
||||
argsAttribute.String(argsBuilder.String()),
|
||||
)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user