/
quickwit.go
44 lines (36 loc) 路 1.11 KB
/
quickwit.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 config
import (
odigosv1 "github.com/keyval-dev/odigos/api/odigos/v1alpha1"
commonconf "github.com/keyval-dev/odigos/autoscaler/controllers/common"
"github.com/keyval-dev/odigos/common"
)
const (
qwUrlKey = "QUICKWIT_URL"
)
type Quickwit struct{}
func (e *Quickwit) DestType() common.DestinationType {
return common.QuickwitDestinationType
}
func (e *Quickwit) ModifyConfig(dest *odigosv1.Destination, currentConfig *commonconf.Config) {
if url, exists := dest.Spec.Data[qwUrlKey]; exists {
exporterName := "otlp/quickwit-" + dest.Name
currentConfig.Exporters[exporterName] = commonconf.GenericMap{
"endpoint": url,
"tls": commonconf.GenericMap{
"insecure": true,
},
}
if isTracingEnabled(dest) {
tracesPipelineName := "traces/quickwit-" + dest.Name
currentConfig.Service.Pipelines[tracesPipelineName] = commonconf.Pipeline{
Exporters: []string{exporterName},
}
}
if isLoggingEnabled(dest) {
logsPipelineName := "logs/quickwit-" + dest.Name
currentConfig.Service.Pipelines[logsPipelineName] = commonconf.Pipeline{
Exporters: []string{exporterName},
}
}
}
}