39 lines
744 B
Go
39 lines
744 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"`
|
|
|
|
ShowMetrics bool `json:"show_metrics"`
|
|
}
|