apache / celeborn

Apache Celeborn is an elastic and high-performance service for shuffle and spilled data.
https://celeborn.apache.org/
Apache License 2.0
862 stars 351 forks source link

[CELEBORN-1536] Add option to toggle between human friendly vs single line logging #2672

Open s0nskar opened 1 month ago

s0nskar commented 1 month ago

What changes were proposed in this pull request?

Adding option to choose between human friendly vs single line logging. Currently changes are done only for WorkerInfo and StorageManager. I will extend these to other places as well.

Why are the changes needed?

Currently lot of Celeborn logging is done in multiline format, which makes it human readable but at the same time this is not search/ingestion friendly if we process these logs they get mixed with other logs generated during same timestamp which makes it difficult to use the logs.

Ex – 

s"""
   |Host: $host
   |RpcPort: $rpcPort
   |PushPort: $pushPort
   |FetchPort: $fetchPort
   |ReplicatePort: $replicatePort
   |InternalPort: $internalPort
   |SlotsUsed: $slots
   |LastHeartbeat: $lastHeartbeat
   |HeartbeatElapsedSeconds: ${TimeUnit.MILLISECONDS.toSeconds(
  System.currentTimeMillis() - lastHeartbeat)}
   |Disks: $diskInfosString
   |UserResourceConsumption: $userResourceConsumptionString
   |WorkerRef: $endpoint
   |WorkerStatus: $workerStatus
   |""".stripMargin 

Logs after ingestion

2024-07-30T12:33:18+05:30 ReplicatePort: 40643
2024-07-30T12:33:18+05:30 SlotsUsed: 0
2024-07-30T12:33:18+05:30 PushPort: 44507
2024-07-30T12:33:18+05:30 InternalPort: 35331
2024-07-30T12:33:18+05:30 HeartbeatElapsedSeconds: 1722322998
2024-07-30T12:33:18+05:30 07:03:18.377 [celeborn-dispatcher-53] INFO  org.apache.celeborn.service.deploy.master.Master - Registered worker 
2024-07-30T12:33:18+05:30 RpcPort: 35331
2024-07-30T12:33:18+05:30   UserIdentifier: `default`.`default`, ResourceConsumption: ResourceConsumption(diskBytesWritten: 0.0 B, diskFileCount: 0, hdfsBytesWritten: 0.0 B, hdfsFileCount: 0, subResourceConsumptions: empty)
2024-07-30T12:33:18+05:30 WorkerStatus: WorkerStatus{state=Normal, stateStartTime=1722322998376}
2024-07-30T12:33:18+05:30 WorkerRef: null
2024-07-30T12:33:18+05:30 .
2024-07-30T12:33:18+05:30 07:03:18.500 [celeborn-dispatcher-59] WARN  org.apache.celeborn.service.deploy.master.Master - Received heartbeat from unknown worker 10.68.220.83:33925:38829:46463:41093.
2024-07-30T12:33:18+05:30 PushPort: 38829
2024-07-30T12:33:18+05:30 FetchPort: 46463
2024-07-30T12:33:18+05:30 SlotsUsed: 0
2024-07-30T12:33:18+05:30 WorkerRef: null
2024-07-30T12:33:18+05:30 InternalPort: 33925
2024-07-30T12:33:18+05:30 .
2024-07-30T12:33:18+05:30 LastHeartbeat: 0
2024-07-30T12:33:18+05:30   DiskInfo0: DiskInfo(maxSlots: 1600, committed shuffles 0, running applications 0, shuffleAllocations: Map(), mountPoint: /, usableSpace: 100.0 GiB, totalSpace: 100.0 GiB, avgFlushTime: 206429 ns, avgFetchTime: 6.1 ms, activeSlots: 0, storageType: HDD) status: HEALTHY dirs 

Does this PR introduce any user-facing change?

User can toggle celeborn.humanFriendlyLog.enabled flag to enable/disable the human friendly logging. By default it will be true to preserve the current behaviour.

How was this patch tested?

Working on testing

s0nskar commented 1 month ago

@SteNicholas @waitinfuture @pan3793 wdyt about this change. We can fix this at more places incrementally.

s0nskar commented 3 weeks ago

@SteNicholas @waitinfuture ping for this ^

FMX commented 3 weeks ago

We can set logger levels for components. Maybe this won't be a trouble.

s0nskar commented 3 weeks ago

@FMX this mainly aims to improve the Master and Worker logging. If i want to keep such logs but don't want it in human readable way to avoid new lines.

github-actions[bot] commented 2 days ago

This PR is stale because it has been open 20 days with no activity. Remove stale label or comment or this will be closed in 10 days.