-
-
Notifications
You must be signed in to change notification settings - Fork 109
/
config.go
50 lines (41 loc) · 1.34 KB
/
config.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package tracing
import (
"bytes"
_ "embed"
"io"
)
// JaegerConfig encapsulates jaeger's configuration.
type JaegerConfig struct {
LocalAgentAddress string `json:"local_agent_address"`
Sampling *JaegerSampling `json:"sampling"`
Propagation string `json:"propagation"`
MaxTagValueLength int `json:"max_tag_value_length"`
}
type JaegerSampling struct {
Type string `json:"type"`
Value float64 `json:"value"`
ServerURL string `json:"server_url"`
}
// ZipkinConfig encapsulates zipkin's configuration.
type ZipkinConfig struct {
ServerURL string `json:"server_url"`
}
type Config struct {
ServiceName string `json:"service_name"`
Provider string `json:"provider"`
Providers *ProvidersConfig `json:"providers"`
}
type ProvidersConfig struct {
Jaeger *JaegerConfig `json:"jaeger"`
Zipkin *ZipkinConfig `json:"zipkin"`
}
//go:embed config.schema.json
var ConfigSchema string
const ConfigSchemaID = "ory://tracing-config"
// AddConfigSchema adds the tracing schema to the compiler.
// The interface is specified instead of `jsonschema.Compiler` to allow the use of any jsonschema library fork or version.
func AddConfigSchema(c interface {
AddResource(url string, r io.Reader) error
}) error {
return c.AddResource(ConfigSchemaID, bytes.NewBufferString(ConfigSchema))
}