Skip to content

Commit

Permalink
feat: libgse 支持 monitoring 定制化方案 --story=120460837 (#600)
Browse files Browse the repository at this point in the history
  • Loading branch information
chenjiandongx authored Oct 31, 2024
1 parent 0369ac8 commit b10648b
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gtmproject.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,5 @@ project:
- sliwebhook
- influxdbproxy
- influxdb
- libgse
reviewers: [ ]
18 changes: 18 additions & 0 deletions pkg/libgse/output/bkpush/bkpush.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ import (
"github.com/elastic/beats/libbeat/publisher"
"github.com/spf13/cast"

gseinfo "github.com/TencentBlueKing/bkmonitor-datalink/pkg/libgse/gse"
"github.com/TencentBlueKing/bkmonitor-datalink/pkg/libgse/logp"
"github.com/TencentBlueKing/bkmonitor-datalink/pkg/libgse/monitoring/report/bkpipe"
"github.com/TencentBlueKing/bkmonitor-datalink/pkg/libgse/output/gse"
)

Expand Down Expand Up @@ -120,6 +122,7 @@ func New(cfg *common.Config) (*Output, error) {
go o.loopHandle()
}

bkpipe.InitSender(o, gseinfo.AgentInfo{}) // TODO(mando): 兼容 bkpipe 自定义指标上报 ┓(=´∀`=)┏
return o, nil
}

Expand All @@ -128,6 +131,21 @@ func (o *Output) Close() error {
return nil
}

func (o *Output) Report(dataid int32, data common.MapStr) error {
r := &Record{
DataID: dataid,
Data: data,
}

select {
case o.ch <- r:
case <-o.stop:
return nil
}

return nil
}

func (o *Output) String() string { return outputType }

func (o *Output) Publish(batch publisher.Batch) error {
Expand Down

0 comments on commit b10648b

Please sign in to comment.