Skip to content

Commit

Permalink
feat: ingester support custom service
Browse files Browse the repository at this point in the history
  • Loading branch information
lzf575 committed Feb 14, 2025
1 parent 42a2a81 commit 65bb31f
Show file tree
Hide file tree
Showing 11 changed files with 146 additions and 36 deletions.
10 changes: 6 additions & 4 deletions server/ingester/app_log/decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -270,15 +270,16 @@ func (d *Decoder) WriteAgentLog(agentId uint16, bs []byte) error {
s.SubnetID = uint16(info.SubnetID)
// if it is just Pod Node, there is no need to match the service
if ingestercommon.IsPodServiceIP(flow_metrics.DeviceType(s.L3DeviceType), s.PodID, 0) {
s.ServiceID = d.platformData.QueryService(s.OrgId,
s.ServiceID = d.platformData.QueryPodService(s.OrgId,
s.PodID, s.PodNodeID, uint32(s.PodClusterID), s.PodGroupID, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0, 0)
}
} else if baseInfo := d.platformData.QueryEpcIDBaseInfo(s.OrgId, s.L3EpcID); baseInfo != nil {
s.RegionID = uint16(baseInfo.RegionID)
}

s.AutoInstanceID, s.AutoInstanceType = ingestercommon.GetAutoInstance(s.PodID, 0, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), s.L3EpcID)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(s.ServiceID, s.PodGroupID, 0, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)
customServiceID := d.platformData.QueryCustomService(s.OrgId, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(customServiceID, s.ServiceID, s.PodGroupID, 0, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)
}

severityText := ""
Expand Down Expand Up @@ -437,15 +438,16 @@ func (d *Decoder) WriteAppLog(agentId uint16, l *AppLogEntry) error {
s.IP6 = info.IP6
// if it is just Pod Node, there is no need to match the service
if ingestercommon.IsPodServiceIP(flow_metrics.DeviceType(s.L3DeviceType), s.PodID, 0) {
s.ServiceID = d.platformData.QueryService(s.OrgId,
s.ServiceID = d.platformData.QueryPodService(s.OrgId,
s.PodID, s.PodNodeID, uint32(s.PodClusterID), s.PodGroupID, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0, 0)
}
} else if baseInfo := d.platformData.QueryEpcIDBaseInfo(s.OrgId, s.L3EpcID); baseInfo != nil {
s.RegionID = uint16(baseInfo.RegionID)
}

s.AutoInstanceID, s.AutoInstanceType = ingestercommon.GetAutoInstance(s.PodID, 0, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), s.L3EpcID)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(s.ServiceID, s.PodGroupID, 0, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)
customServiceID := d.platformData.QueryCustomService(s.OrgId, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(customServiceID, s.ServiceID, s.PodGroupID, 0, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)

d.logWriter.Write(s)
return nil
Expand Down
13 changes: 8 additions & 5 deletions server/ingester/common/common.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,8 +149,9 @@ const (
PodType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_POD) // 10
PodNodeType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_POD_NODE) // 14

PodServiceType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_POD_SERVICE) // 12
PodClusterType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_POD_CLUSTER) // 103
PodServiceType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_POD_SERVICE) // 12
PodClusterType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_POD_CLUSTER) // 103
CustomServiceType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_CUSTOM_SERVICE) // 104

ProcessType = uint8(trident.AutoServiceType_AUTO_SERVICE_TYPE_PROCESS) // 120

Expand All @@ -172,9 +173,11 @@ func GetAutoInstance(podID, gpID, podNodeID, l3DeviceID, subnetID uint32, l3Devi
return subnetID, IpType
}

func GetAutoService(serviceID, podGroupID, gpID, podClusterID, l3DeviceID, subnetID uint32, l3DeviceType, podGroupType uint8, l3EpcID int32) (uint32, uint8) {
if serviceID > 0 {
return serviceID, PodServiceType
func GetAutoService(customServiceID, podServiceID, podGroupID, gpID, podClusterID, l3DeviceID, subnetID uint32, l3DeviceType, podGroupType uint8, l3EpcID int32) (uint32, uint8) {
if customServiceID > 0 {
return customServiceID, CustomServiceType
} else if podServiceID > 0 {
return podServiceID, PodServiceType
} else if podGroupID > 0 {
return podGroupID, podGroupType
} else if gpID > 0 {
Expand Down
9 changes: 6 additions & 3 deletions server/ingester/event/decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -239,15 +239,16 @@ func (d *Decoder) WritePerfEvent(vtapId uint16, e *pb.ProcEvent) {
s.IP6 = info.IP6
// if it is just Pod Node, there is no need to match the service
if ingestercommon.IsPodServiceIP(flow_metrics.DeviceType(s.L3DeviceType), s.PodID, 0) {
s.ServiceID = d.platformData.QueryService(s.OrgId,
s.ServiceID = d.platformData.QueryPodService(s.OrgId,
s.PodID, s.PodNodeID, uint32(s.PodClusterID), s.PodGroupID, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0, 0)
}
} else if baseInfo := d.platformData.QueryEpcIDBaseInfo(s.OrgId, s.L3EpcID); baseInfo != nil {
s.RegionID = uint16(baseInfo.RegionID)
}

s.AutoInstanceID, s.AutoInstanceType = ingestercommon.GetAutoInstance(s.PodID, s.GProcessID, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), s.L3EpcID)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(s.ServiceID, s.PodGroupID, s.GProcessID, uint32(s.PodClusterID), s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)
customServiceID := d.platformData.QueryCustomService(s.OrgId, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(customServiceID, s.ServiceID, s.PodGroupID, s.GProcessID, uint32(s.PodClusterID), s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)

s.AppInstance = strconv.Itoa(int(e.Pid))

Expand Down Expand Up @@ -398,11 +399,13 @@ func (d *Decoder) handleResourceEvent(event *eventapi.ResourceEvent) {
if event.InstanceType == uint32(trident.DeviceType_DEVICE_TYPE_POD_SERVICE) {
s.ServiceID = event.InstanceID
} else if ingestercommon.IsPodServiceIP(flow_metrics.DeviceType(s.L3DeviceType), s.PodID, 0) {
s.ServiceID = d.platformData.QueryService(s.OrgId, s.PodID, s.PodNodeID, uint32(s.PodClusterID), s.PodGroupID, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0, 0)
s.ServiceID = d.platformData.QueryPodService(s.OrgId, s.PodID, s.PodNodeID, uint32(s.PodClusterID), s.PodGroupID, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0, 0)
}

customServiceID := d.platformData.QueryCustomService(s.OrgId, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0)
s.AutoServiceID, s.AutoServiceType =
ingestercommon.GetAutoService(
customServiceID,
s.ServiceID,
s.PodGroupID,
s.GProcessID,
Expand Down
5 changes: 3 additions & 2 deletions server/ingester/event/decoder/k8s_event.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,15 +104,16 @@ func (d *Decoder) WriteK8sEvent(vtapId uint16, e *pb.KubernetesEvent) {
s.IP6 = info.IP6
// if it is just Pod Node, there is no need to match the service
if ingestercommon.IsPodServiceIP(flow_metrics.DeviceType(s.L3DeviceType), s.PodID, 0) {
s.ServiceID = d.platformData.QueryService(s.OrgId,
s.ServiceID = d.platformData.QueryPodService(s.OrgId,
s.PodID, s.PodNodeID, uint32(s.PodClusterID), s.PodGroupID, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0, 0)
}
} else if baseInfo := d.platformData.QueryEpcIDBaseInfo(s.OrgId, s.L3EpcID); baseInfo != nil {
s.RegionID = uint16(baseInfo.RegionID)
}

s.AutoInstanceID, s.AutoInstanceType = ingestercommon.GetAutoInstance(s.PodID, s.GProcessID, s.PodNodeID, s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), s.L3EpcID)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(s.ServiceID, s.PodGroupID, s.GProcessID, uint32(s.PodClusterID), s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)
customServiceID := d.platformData.QueryCustomService(s.OrgId, s.L3EpcID, !s.IsIPv4, s.IP4, s.IP6, 0)
s.AutoServiceID, s.AutoServiceType = ingestercommon.GetAutoService(customServiceID, s.ServiceID, s.PodGroupID, s.GProcessID, uint32(s.PodClusterID), s.L3DeviceID, uint32(s.SubnetID), uint8(s.L3DeviceType), podGroupType, s.L3EpcID)

d.eventWriter.Write(s)
}
Expand Down
5 changes: 3 additions & 2 deletions server/ingester/ext_metrics/decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -341,10 +341,11 @@ func (d *Decoder) fillExtMetricsBaseSlow(m *dbwriter.ExtMetrics, vtapID uint16,
}

if common.IsPodServiceIP(t.L3DeviceType, t.PodID, t.PodNodeID) {
t.ServiceID = d.platformData.QueryService(m.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv6 == 1, t.IP, t.IP6, 0, 0)
t.ServiceID = d.platformData.QueryPodService(m.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv6 == 1, t.IP, t.IP6, 0, 0)
}
t.AutoInstanceID, t.AutoInstanceType = common.GetAutoInstance(t.PodID, t.GPID, t.PodNodeID, t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), t.L3EpcID)
t.AutoServiceID, t.AutoServiceType = common.GetAutoService(t.ServiceID, t.PodGroupID, t.GPID, uint32(t.PodClusterID), t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), podGroupType, t.L3EpcID)
customServiceID := d.platformData.QueryCustomService(m.OrgId, t.L3EpcID, t.IsIPv6 == 1, t.IP, t.IP6, 0)
t.AutoServiceID, t.AutoServiceType = common.GetAutoService(customServiceID, t.ServiceID, t.PodGroupID, t.GPID, uint32(t.PodClusterID), t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), podGroupType, t.L3EpcID)
}
}

Expand Down
10 changes: 6 additions & 4 deletions server/ingester/flow_log/log_data/l4_flow_log.go
Original file line number Diff line number Diff line change
Expand Up @@ -684,17 +684,19 @@ func (k *KnowledgeGraph) fill(

// 0端如果是clusterIP或后端podIP需要匹配service_id
if common.IsPodServiceIP(flow_metrics.DeviceType(k.L3DeviceType0), k.PodID0, 0) {
k.ServiceID0 = platformData.QueryService(k.OrgId, k.PodID0, k.PodNodeID0, uint32(k.PodClusterID0), k.PodGroupID0, l3EpcID0, isIPv6, ip40, ip60, protocol, 0)
k.ServiceID0 = platformData.QueryPodService(k.OrgId, k.PodID0, k.PodNodeID0, uint32(k.PodClusterID0), k.PodGroupID0, l3EpcID0, isIPv6, ip40, ip60, protocol, 0)
}
if common.IsPodServiceIP(flow_metrics.DeviceType(k.L3DeviceType1), k.PodID1, k.PodNodeID1) {
k.ServiceID1 = platformData.QueryService(k.OrgId, k.PodID1, k.PodNodeID1, uint32(k.PodClusterID1), k.PodGroupID1, l3EpcID1, isIPv6, ip41, ip61, protocol, port)
k.ServiceID1 = platformData.QueryPodService(k.OrgId, k.PodID1, k.PodNodeID1, uint32(k.PodClusterID1), k.PodGroupID1, l3EpcID1, isIPv6, ip41, ip61, protocol, port)
}

k.AutoInstanceID0, k.AutoInstanceType0 = common.GetAutoInstance(k.PodID0, gpID0, k.PodNodeID0, k.L3DeviceID0, uint32(k.SubnetID0), k.L3DeviceType0, k.L3EpcID0)
k.AutoServiceID0, k.AutoServiceType0 = common.GetAutoService(k.ServiceID0, k.PodGroupID0, gpID0, uint32(k.PodClusterID0), k.L3DeviceID0, uint32(k.SubnetID0), k.L3DeviceType0, k.PodGroupType0, k.L3EpcID0)
customServiceID0 := platformData.QueryCustomService(k.OrgId, l3EpcID0, isIPv6, ip40, ip60, 0)
k.AutoServiceID0, k.AutoServiceType0 = common.GetAutoService(customServiceID0, k.ServiceID0, k.PodGroupID0, gpID0, uint32(k.PodClusterID0), k.L3DeviceID0, uint32(k.SubnetID0), k.L3DeviceType0, k.PodGroupType0, k.L3EpcID0)

k.AutoInstanceID1, k.AutoInstanceType1 = common.GetAutoInstance(k.PodID1, gpID1, k.PodNodeID1, k.L3DeviceID1, uint32(k.SubnetID1), k.L3DeviceType1, k.L3EpcID1)
k.AutoServiceID1, k.AutoServiceType1 = common.GetAutoService(k.ServiceID1, k.PodGroupID1, gpID1, uint32(k.PodClusterID1), k.L3DeviceID1, uint32(k.SubnetID1), k.L3DeviceType1, k.PodGroupType1, k.L3EpcID1)
customServiceID1 := platformData.QueryCustomService(k.OrgId, l3EpcID1, isIPv6, ip41, ip61, port)
k.AutoServiceID1, k.AutoServiceType1 = common.GetAutoService(customServiceID1, k.ServiceID1, k.PodGroupID1, gpID1, uint32(k.PodClusterID1), k.L3DeviceID1, uint32(k.SubnetID1), k.L3DeviceType1, k.PodGroupType1, k.L3EpcID1)
}

func (k *KnowledgeGraph) FillL4(f *pb.Flow, isIPv6 bool, platformData *grpc.PlatformInfoTable) {
Expand Down
17 changes: 12 additions & 5 deletions server/ingester/flow_metrics/unmarshaller/handle_document.go
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ func DocumentExpand(doc app.Document, platformData *grpc.PlatformInfoTable) erro
t.PodID1 = info1.PodID
t.PodClusterID1 = uint16(info1.PodClusterID)
if common.IsPodServiceIP(t.L3DeviceType1, t.PodID1, t.PodNodeID1) {
t.ServiceID1 = platformData.QueryService(t.OrgId, t.PodID1, t.PodNodeID1, uint32(t.PodClusterID1), t.PodGroupID1, t.L3EpcID1, t.IsIPv4 == 0, t.IP1, t.IP61, t.Protocol, t.ServerPort)
t.ServiceID1 = platformData.QueryPodService(t.OrgId, t.PodID1, t.PodNodeID1, uint32(t.PodClusterID1), t.PodGroupID1, t.L3EpcID1, t.IsIPv4 == 0, t.IP1, t.IP61, t.Protocol, t.ServerPort)
}
if info == nil {
var ip0 net.IP
Expand All @@ -175,7 +175,8 @@ func DocumentExpand(doc app.Document, platformData *grpc.PlatformInfoTable) erro
}
}
t.AutoInstanceID1, t.AutoInstanceType1 = common.GetAutoInstance(t.PodID1, t.GPID1, t.PodNodeID1, t.L3DeviceID1, uint32(t.SubnetID1), uint8(t.L3DeviceType1), t.L3EpcID1)
t.AutoServiceID1, t.AutoServiceType1 = common.GetAutoService(t.ServiceID1, t.PodGroupID1, t.GPID1, uint32(t.PodClusterID1), t.L3DeviceID1, uint32(t.SubnetID1), uint8(t.L3DeviceType1), podGroupType1, t.L3EpcID1)
customSeriviceID1 := platformData.QueryCustomService(t.OrgId, t.L3EpcID1, t.IsIPv4 == 0, t.IP1, t.IP61, t.ServerPort)
t.AutoServiceID1, t.AutoServiceType1 = common.GetAutoService(customSeriviceID1, t.ServiceID1, t.PodGroupID1, t.GPID1, uint32(t.PodClusterID1), t.L3DeviceID1, uint32(t.SubnetID1), uint8(t.L3DeviceType1), podGroupType1, t.L3EpcID1)

if info != nil {
t.RegionID = uint16(info.RegionID)
Expand All @@ -193,10 +194,10 @@ func DocumentExpand(doc app.Document, platformData *grpc.PlatformInfoTable) erro
if common.IsPodServiceIP(t.L3DeviceType, t.PodID, t.PodNodeID) {
//for a single-side table (vtap_xxx_port), if ServerPort is valid, it needs to match the serviceID
if t.ServerPort > 0 && t.Code&EdgeCode == 0 {
t.ServiceID = platformData.QueryService(t.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv4 == 0, t.IP, t.IP6, t.Protocol, t.ServerPort)
t.ServiceID = platformData.QueryPodService(t.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv4 == 0, t.IP, t.IP6, t.Protocol, t.ServerPort)
// for the 0-side of the double-side table (vtap_xxx_edge_port) or serverPort is invalid, if it is PodServiceIP, then need to match the serviceID
} else if common.IsPodServiceIP(t.L3DeviceType, t.PodID, 0) { //On the 0 side, if it is just Pod Node, there is no need to match the service
t.ServiceID = platformData.QueryService(t.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv4 == 0, t.IP, t.IP6, t.Protocol, 0)
t.ServiceID = platformData.QueryPodService(t.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv4 == 0, t.IP, t.IP6, t.Protocol, 0)
}
}
if info1 == nil && (t.Code&EdgeCode == EdgeCode) {
Expand Down Expand Up @@ -230,7 +231,13 @@ func DocumentExpand(doc app.Document, platformData *grpc.PlatformInfoTable) erro
}
}
t.AutoInstanceID, t.AutoInstanceType = common.GetAutoInstance(t.PodID, t.GPID, t.PodNodeID, t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), t.L3EpcID)
t.AutoServiceID, t.AutoServiceType = common.GetAutoService(t.ServiceID, t.PodGroupID, t.GPID, uint32(t.PodClusterID), t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), podGroupType, t.L3EpcID)
serverPort := uint16(0)
//for a single-side table (network,application), it needs to match the cuustomServiceID with ServerPort
if t.Code&EdgeCode == 0 {
serverPort = t.ServerPort
}
customServiceID := platformData.QueryCustomService(t.OrgId, t.L3EpcID, t.IsIPv4 == 0, t.IP, t.IP6, serverPort)
t.AutoServiceID, t.AutoServiceType = common.GetAutoService(customServiceID, t.ServiceID, t.PodGroupID, t.GPID, uint32(t.PodClusterID), t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), podGroupType, t.L3EpcID)

if t.SignalSource == SIGNAL_SOURCE_OTEL {
// only show OTel data for services as 'server side'
Expand Down
5 changes: 3 additions & 2 deletions server/ingester/profile/dbwriter/profile.go
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ func (p *InProcessProfile) fillResource(vtapID uint16, podID uint32, platformDat
podGroupType = info.PodGroupType
p.L3DeviceType = uint8(info.DeviceType)
p.L3DeviceID = info.DeviceID
p.ServiceID = platformData.QueryService(p.OrgId, p.PodID, p.PodNodeID, uint32(p.PodClusterID), p.PodGroupID, p.L3EpcID, !p.IsIPv4, p.IP4, p.IP6, layers.IPProtocolTCP, 0)
p.ServiceID = platformData.QueryPodService(p.OrgId, p.PodID, p.PodNodeID, uint32(p.PodClusterID), p.PodGroupID, p.L3EpcID, !p.IsIPv4, p.IP4, p.IP6, layers.IPProtocolTCP, 0)
}

// fix up when all resource match failed
Expand All @@ -380,7 +380,8 @@ func (p *InProcessProfile) fillResource(vtapID uint16, podID uint32, platformDat
}

p.AutoInstanceID, p.AutoInstanceType = basecommon.GetAutoInstance(p.PodID, p.GPID, p.PodNodeID, p.L3DeviceID, uint32(p.SubnetID), p.L3DeviceType, p.L3EpcID)
p.AutoServiceID, p.AutoServiceType = basecommon.GetAutoService(p.ServiceID, p.PodGroupID, p.GPID, uint32(p.PodClusterID), p.L3DeviceID, uint32(p.SubnetID), p.L3DeviceType, podGroupType, p.L3EpcID)
customServiceID := platformData.QueryCustomService(p.OrgId, p.L3EpcID, !p.IsIPv4, p.IP4, p.IP6, 0)
p.AutoServiceID, p.AutoServiceType = basecommon.GetAutoService(customServiceID, p.ServiceID, p.PodGroupID, p.GPID, uint32(p.PodClusterID), p.L3DeviceID, uint32(p.SubnetID), p.L3DeviceType, podGroupType, p.L3EpcID)

}

Expand Down
5 changes: 3 additions & 2 deletions server/ingester/prometheus/decoder/decoder.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,11 @@ func (b *PrometheusSamplesBuilder) fillUniversalTagSlow(m *dbwriter.PrometheusSa

// if it is just Pod Node, there is no need to match the service
if common.IsPodServiceIP(t.L3DeviceType, t.PodID, 0) {
t.ServiceID = b.platformData.QueryService(m.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv6 == 1, t.IP, t.IP6, 0, 0)
t.ServiceID = b.platformData.QueryPodService(m.OrgId, t.PodID, t.PodNodeID, uint32(t.PodClusterID), t.PodGroupID, t.L3EpcID, t.IsIPv6 == 1, t.IP, t.IP6, 0, 0)
}
t.AutoInstanceID, t.AutoInstanceType = common.GetAutoInstance(t.PodID, t.GPID, t.PodNodeID, t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), t.L3EpcID)
t.AutoServiceID, t.AutoServiceType = common.GetAutoService(t.ServiceID, t.PodGroupID, t.GPID, uint32(t.PodClusterID), t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), podGroupType, t.L3EpcID)
customServiceID := b.platformData.QueryCustomService(m.OrgId, t.L3EpcID, t.IsIPv6 == 1, t.IP, t.IP6, 0)
t.AutoServiceID, t.AutoServiceType = common.GetAutoService(customServiceID, t.ServiceID, t.PodGroupID, t.GPID, uint32(t.PodClusterID), t.L3DeviceID, uint32(t.SubnetID), uint8(t.L3DeviceType), podGroupType, t.L3EpcID)
}
}

Expand Down
8 changes: 6 additions & 2 deletions server/libs/grpc/grpc_platformdata.go
Original file line number Diff line number Diff line change
Expand Up @@ -380,8 +380,12 @@ func (t *PlatformInfoTable) QueryPodIdInfo(orgId uint16, podId uint32) *Info {
return nil
}

func (t *PlatformInfoTable) QueryService(orgId uint16, podID, podNodeID, podClusterID, podGroupID uint32, epcID int32, isIPv6 bool, ipv4 uint32, ipv6 net.IP, protocol layers.IPProtocol, serverPort uint16) uint32 {
return t.ServiceTable[orgId].QueryService(podID, podNodeID, podClusterID, podGroupID, epcID, isIPv6, ipv4, ipv6, protocol, serverPort)
func (t *PlatformInfoTable) QueryPodService(orgId uint16, podID, podNodeID, podClusterID, podGroupID uint32, epcID int32, isIPv6 bool, ipv4 uint32, ipv6 net.IP, protocol layers.IPProtocol, serverPort uint16) uint32 {
return t.ServiceTable[orgId].QueryPodService(podID, podNodeID, podClusterID, podGroupID, epcID, isIPv6, ipv4, ipv6, protocol, serverPort)
}

func (t *PlatformInfoTable) QueryCustomService(orgId uint16, epcID int32, isIPv6 bool, ipv4 uint32, ipv6 net.IP, serverPort uint16) uint32 {
return t.ServiceTable[orgId].QueryCustomService(epcID, isIPv6, ipv4, ipv6, serverPort)
}

func (t *PlatformInfoTable) QueryResourceInfo(orgId uint16, resourceType uint32, resourceID uint32) *Info {
Expand Down
Loading

0 comments on commit 65bb31f

Please sign in to comment.