Skip to content

Commit 076c2cf

Browse files
committed
STAC-12663: Pass Kubernetes cluster name to StackState receiver if it is present
1 parent 5247c99 commit 076c2cf

3 files changed

Lines changed: 158 additions & 105 deletions

File tree

checks/net.go

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ import (
44
"bytes"
55
"errors"
66
"fmt"
7+
"strings"
8+
"time"
9+
710
"github.com/StackVista/stackstate-process-agent/cmd/agent/features"
811
"github.com/StackVista/stackstate-process-agent/config"
912
"github.com/StackVista/stackstate-process-agent/model"
@@ -12,7 +15,6 @@ import (
1215
"github.com/StackVista/tcptracer-bpf/pkg/tracer/common"
1316
log "github.com/cihub/seelog"
1417
"github.com/patrickmn/go-cache"
15-
"time"
1618
)
1719

1820
var (
@@ -154,12 +156,18 @@ func batchConnections(cfg *config.AgentConfig, groupID int32, cxs []*model.Conne
154156

155157
// STS: Disable batching for now
156158
batchSize := min(cfg.MaxPerMessage, len(cxs))
157-
batches = append(batches, &model.CollectorConnections{
159+
batch := &model.CollectorConnections{
158160
HostName: cfg.HostName,
159161
Connections: cxs[:batchSize],
160162
GroupId: groupID,
161163
GroupSize: 1,
162-
})
164+
}
165+
166+
if strings.TrimSpace(cfg.ClusterName) != "" {
167+
batch.ClusterName = cfg.ClusterName
168+
}
169+
170+
batches = append(batches, batch)
163171

164172
return batches
165173
}

0 commit comments

Comments
 (0)