Skip to content

Commit d66d092

Browse files
committed
fix: timeout and metrics push
1 parent 2c8eae1 commit d66d092

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

exporter/dorisexporter/exporter_common.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ func streamLoadRequest(ctx context.Context, cfg *Config, table string, data []by
8282
req.Header.Set("format", "json")
8383
req.Header.Set("Expect", "100-continue")
8484
req.Header.Set("strip_outer_array", "true")
85+
if cfg.ClientConfig.Timeout != 0 {
86+
req.Header.Set("timeout", fmt.Sprintf("%d", cfg.ClientConfig.Timeout/time.Second))
87+
}
8588
req.SetBasicAuth(cfg.Username, string(cfg.Password))
8689

8790
return req, nil

exporter/dorisexporter/exporter_metrics.go

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,10 @@ func (e *metricsExporter) pushMetricDataParallel(ctx context.Context, metricMap
145145
errChan := make(chan error, len(metricMap))
146146
wg := &sync.WaitGroup{}
147147
for _, m := range metricMap {
148+
if m.size() <= 0 {
149+
continue
150+
}
151+
148152
wg.Add(1)
149153
go func(m metricModel, wg *sync.WaitGroup) {
150154
errChan <- e.pushMetricDataInternal(ctx, m)

0 commit comments

Comments
 (0)