- synchandler: combine course date with clock time via time.Date instead of adding two absolute Unix epochs, which produced corrupt start times - tracing: make DeploymentEnvironment configurable via config.Trace (defaults to development instead of hardcoded production) - http: align course handler tracer name to 'kuriweb.http' to match the request middleware instrument so spans share the same tracer
40 lines
802 B
Go
40 lines
802 B
Go
package config
|
|
|
|
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"`
|
|
Environment string `json:"environment"`
|
|
|
|
ShowMetrics bool `json:"show_metrics"`
|
|
}
|