)]}'
{
  "commit": "36df516f737bfc665dab7312703d826f9dcf527e",
  "tree": "7499c22c917af40071d96400f1ef54ab306a6397",
  "parents": [
    "1d3ba73f4acebdf798ce35ba6c26a47c614f8bbb"
  ],
  "author": {
    "name": "songzhendong",
    "email": "xiaodong12315@qq.com",
    "time": "Sun Jun 28 20:37:10 2026 +0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Sun Jun 28 20:37:10 2026 +0800"
  },
  "message": "Refactor gRPC runtime services and add Node.js runtime metrics (#139)\n\nRefactor gRPC service lifecycle and add Node.js runtime metrics\n\nThis PR replaces the old per-client gRPC protocol wiring with a ServiceManager-based lifecycle and a shared grpc-js channel manager, using the Java agent core service model as structural reference while keeping Node.js-specific async behavior.\n\nIt adds Node.js runtime metric collection through MeterReportService, including process CPU, heap, RSS, external memory, and heap limit meters, with bounded buffering, configurable collection/report intervals, and deprecated runtime metric config aliases.\n\nThe gRPC lifecycle now includes explicit shutdown guards, stale callback protection, DISCONNECT handling, per-call deadlines, throttled error logging, and controlled report/flush scheduling to avoid agent-side crashes, duplicate timers, or unnecessary RPC work while disconnected.\n\nVerified with lint, build, focused config/runtime/channel tests, and manual lifecycle repros for shutdown, late grpc-js callbacks, reconnect state, and destroy/start config behavior.",
  "tree_diff": [
    {
      "type": "modify",
      "old_id": "2a31b3e40450f5f3b5e3879be8b1ce93a37b2dce",
      "old_mode": 33188,
      "old_path": "README.md",
      "new_id": "50586c5d9839539c64ede9213a3471f4347dffee",
      "new_mode": 33188,
      "new_path": "README.md"
    },
    {
      "type": "copy",
      "old_id": "8d8fd06926dfeec3ed393e722f8503ac105f4731",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/clients/Client.ts",
      "new_id": "34a53d5c554351fa0c6a7aa7b8a39e31ce7c29bb",
      "new_mode": 33188,
      "new_path": "src/agent/core/boot/BootService.ts",
      "score": 79
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "e5dd18db611472910bc83a89027b611e7ee5df63",
      "new_mode": 33188,
      "new_path": "src/agent/core/boot/ServiceManager.ts"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "b66d370a072333b4d6d725ee14771ecd8da39600",
      "new_mode": 33188,
      "new_path": "src/agent/core/meter/MeterSender.ts"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "0d59a296492b9be91954f497a6d2a59b49be5663",
      "new_mode": 33188,
      "new_path": "src/agent/core/meter/RuntimeMetricsCollector.ts"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "c7ac80eb823d83f63e2923854a932b70d80427b3",
      "new_mode": 33188,
      "new_path": "src/agent/core/meter/RuntimeSampler.ts"
    },
    {
      "type": "copy",
      "old_id": "0f5ae4d5ed20f956b89f36d4f97ee39225f42bd5",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/AuthInterceptor.ts",
      "new_id": "6f77406eae978c2ff087d090cf19cd67dda0f968",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/AgentIDDecorator.ts",
      "score": 61
    },
    {
      "type": "copy",
      "old_id": "0f5ae4d5ed20f956b89f36d4f97ee39225f42bd5",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/AuthInterceptor.ts",
      "new_id": "b0d138fee2cd922145a8662d31a83f1d1c53725d",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/AuthenticationDecorator.ts",
      "score": 60
    },
    {
      "type": "copy",
      "old_id": "0f5ae4d5ed20f956b89f36d4f97ee39225f42bd5",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/AuthInterceptor.ts",
      "new_id": "9a2d7c9be45de78b051b8a7c5cca6c49326b914e",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/ChannelBuilder.ts",
      "score": 72
    },
    {
      "type": "rename",
      "old_id": "0f5ae4d5ed20f956b89f36d4f97ee39225f42bd5",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/AuthInterceptor.ts",
      "new_id": "c99319dbb2ce60e0202a11409ad53fd221c9d23c",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/ChannelDecorator.ts",
      "score": 77
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "4eae558880fa4ea09ca4f7dc77c7550081917293",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/GRPCChannel.ts"
    },
    {
      "type": "copy",
      "old_id": "8d8fd06926dfeec3ed393e722f8503ac105f4731",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/clients/Client.ts",
      "new_id": "34febaee8e76b71bf12e4f28dbf0fed190070460",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/GRPCChannelListener.ts",
      "score": 84
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "5eb2fedc64a4200e192fc166e8231d4d1ed602f4",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/GRPCChannelManager.ts"
    },
    {
      "type": "rename",
      "old_id": "8d8fd06926dfeec3ed393e722f8503ac105f4731",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/clients/Client.ts",
      "new_id": "5200d585adb60b4ef37b4e4e53d71a1fb233fd9b",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/GRPCChannelStatus.ts",
      "score": 84
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "a558caf17c4127fb52385c09fda0bb1ffde456f5",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/ServiceManagementClient.ts"
    },
    {
      "type": "copy",
      "old_id": "0f5ae4d5ed20f956b89f36d4f97ee39225f42bd5",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/AuthInterceptor.ts",
      "new_id": "ae37f24b244d975e844eb601834638134e160beb",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/StandardChannelBuilder.ts",
      "score": 61
    },
    {
      "type": "copy",
      "old_id": "0f5ae4d5ed20f956b89f36d4f97ee39225f42bd5",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/AuthInterceptor.ts",
      "new_id": "d3d7e517c8b8c516bf7277c10374d2380411a73d",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/TLSChannelBuilder.ts",
      "score": 66
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "3f1812d7dd4ea4e1dcc5e32b2be47642f6079f89",
      "new_mode": 33188,
      "new_path": "src/agent/core/remote/TraceSegmentServiceClient.ts"
    },
    {
      "type": "delete",
      "old_id": "062318a2f9c9f8ff379662f9d3209ce6fc5957a0",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/Protocol.ts",
      "new_id": "0000000000000000000000000000000000000000",
      "new_mode": 0,
      "new_path": "/dev/null"
    },
    {
      "type": "delete",
      "old_id": "f1511414086673f4971dbe59ce913d0e3deb22e7",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/GrpcProtocol.ts",
      "new_id": "0000000000000000000000000000000000000000",
      "new_mode": 0,
      "new_path": "/dev/null"
    },
    {
      "type": "delete",
      "old_id": "6559f203d587ce98d96a93f6690560916b6c0b46",
      "old_mode": 33188,
      "old_path": "src/agent/protocol/grpc/SegmentObjectAdapter.ts",
      "new_id": "0000000000000000000000000000000000000000",
      "new_mode": 0,
      "new_path": "/dev/null"
    },
    {
      "type": "delete",
      "old_id": "2c101a6cb0e6a30ef9c3c2dea5068528eb9024f6",
      "old_mode": 33261,
      "old_path": "src/agent/protocol/grpc/clients/HeartbeatClient.ts",
      "new_id": "0000000000000000000000000000000000000000",
      "new_mode": 0,
      "new_path": "/dev/null"
    },
    {
      "type": "delete",
      "old_id": "4f5cfe78d7a59a3412083866f8f97fd68c69e7e1",
      "old_mode": 33261,
      "old_path": "src/agent/protocol/grpc/clients/TraceReportClient.ts",
      "new_id": "0000000000000000000000000000000000000000",
      "new_mode": 0,
      "new_path": "/dev/null"
    },
    {
      "type": "modify",
      "old_id": "2ad5905d3fada59ec70c452c5f8e37a3a7b61356",
      "old_mode": 33188,
      "old_path": "src/config/AgentConfig.ts",
      "new_id": "54d8a34c01e653098b0cf61ba52677958afd7902",
      "new_mode": 33188,
      "new_path": "src/config/AgentConfig.ts"
    },
    {
      "type": "modify",
      "old_id": "ae2c494b09275e8f9c69d5c3aff7f1c5c574b13c",
      "old_mode": 33188,
      "old_path": "src/index.ts",
      "new_id": "33d67a2179f047c2ccf1d5388b71a83851ea6604",
      "new_mode": 33188,
      "new_path": "src/index.ts"
    },
    {
      "type": "modify",
      "old_id": "9c8a7fd6d9e22219f8fa255e5ffb7bc315bff10f",
      "old_mode": 33188,
      "old_path": "src/trace/context/Segment.ts",
      "new_id": "7d974140b59a100f59f01307c05fdc040361cc22",
      "new_mode": 33188,
      "new_path": "src/trace/context/Segment.ts"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "08b7fd3b74693778021e5460c9ebfed8841e0d4e",
      "new_mode": 33188,
      "new_path": "tests/config/AgentConfig.test.ts"
    },
    {
      "type": "modify",
      "old_id": "891f130fa156ba26e449411146e9612d3df38e03",
      "old_mode": 33188,
      "old_path": "tests/plugins/express/expected.data.yaml",
      "new_id": "afddb2694d373b8c2bad476a26baa88ea6744557",
      "new_mode": 33188,
      "new_path": "tests/plugins/express/expected.data.yaml"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "ad6f16e339bf651d2bdf0a7397a4df351182dd59",
      "new_mode": 33188,
      "new_path": "tests/remote/GRPCChannelManager.test.ts"
    },
    {
      "type": "add",
      "old_id": "0000000000000000000000000000000000000000",
      "old_mode": 0,
      "old_path": "/dev/null",
      "new_id": "35b7833f8179e1dc35cac253cd26b83aa6900f92",
      "new_mode": 33188,
      "new_path": "tests/runtime/RuntimeMetricsCollector.test.ts"
    }
  ]
}
