Skip to content

[BUG] Some bugs in MCP Data Process #10176

@dark-sys000

Description

@dark-sys000

Search before asking

  • I had searched in the issues and found no similar feature requirement.

DeepFlow Component

Agent

What you expected to happen

In file deepflow/server/mcp/handle/profile.go,func generateFunctionMermaidDiagram has code:

for _, row := range profileData.NodeValues.Values {
		if len(row) < 4 {
			continue
		}

		nodeID, err := convertToInt(row[0])
		if err != nil {
			continue
		}

		parentID, err := convertToInt(row[1])
		if err != nil {
			continue
		}

		// 获取当前节点的函数名
		var currentFunction string
		if nodeID < len(profileData.FunctionNames) {
			currentFunction = profileData.FunctionNames[nodeID]
			allFunctions[currentFunction] = true
		}

		// 如果有父节点,建立调用关系
		if parentID != -1 && parentID < len(profileData.FunctionNames) {
			parentFunction := profileData.FunctionNames[parentID]
			allFunctions[parentFunction] = true

			// 记录调用关系:父函数调用子函数
			if parentFunction != currentFunction { // 避免自调用
				callRelations[model.FunctionCallRelation{
					Caller: parentFunction,
					Callee: currentFunction,
				}] = true
			}
		}
	}

In this code,we see the parentID is used to index FunctionNames.
But in deepflow/server/querier/profile/service/profile.go,the code reference parentID is :

                                   nodeID = len(nodes)
				nodeUUIDToID[nodeUUID] = nodeID
				nodes = append(nodes, newProfileTreeNode(locationID, nodeProfileValue, profileValue))
				if runeIndex == 0 {
					nodes[0].TotalValue += profileValue // update root
				}

				if preNodeID >= 0 {
					nodes[preNodeID].ParentNodeID = nodeID
				} else {
					// remember the entier stack
					stackToNodeID[profileLocationCompress] = nodeID // compressed stack
				}

It seems that the variable paretID is wrongly used to index FunctionNames.

How to reproduce

No response

DeepFlow version

latest version

DeepFlow agent list

No response

Kubernetes CNI

No response

Operation-System/Kernel version

No response

Anything else

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions