-
-
Notifications
You must be signed in to change notification settings - Fork 67
/
jaeger.go
44 lines (34 loc) · 860 Bytes
/
jaeger.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
package jaeger
import (
"encoding/json"
"github.com/K-Phoen/grabana/datasource"
"github.com/K-Phoen/sdk"
)
var _ datasource.Datasource = Jaeger{}
type Jaeger struct {
builder *sdk.Datasource
}
type Option func(datasource *Jaeger)
type TraceToLogsOption func(settings map[string]interface{})
func New(name string, url string, options ...Option) Jaeger {
jaeger := &Jaeger{
builder: &sdk.Datasource{
Name: name,
Type: "jaeger",
Access: "proxy",
URL: url,
JSONData: map[string]interface{}{},
SecureJSONData: map[string]interface{}{},
},
}
for _, opt := range options {
opt(jaeger)
}
return *jaeger
}
func (datasource Jaeger) Name() string {
return datasource.builder.Name
}
func (datasource Jaeger) MarshalJSON() ([]byte, error) {
return json.Marshal(datasource.builder)
}