Skip to content

Commit

Permalink
Add more clear logs when oap-cluster-internal data format is inconcsi…
Browse files Browse the repository at this point in the history
…stent (#13059)
  • Loading branch information
wu-sheng authored Feb 21, 2025
1 parent 0f2ef5a commit d98f74d
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 15 deletions.
1 change: 1 addition & 0 deletions docs/en/changes/changes.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@
* Add `Get Alarm Runtime Status` API.
* Add `lock` when query the Alarm metrics window values.
* Add a fail-safe mechanism to prevent traffic metrics inconsistent between in-memory and database server.
* Add more clear logs when oap-cluster-internal data(metrics/traffic) format is inconsistent.

#### UI

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,24 +117,33 @@ public void onNext(RemoteMessage message) {
String nextWorkerName = message.getNextWorkerName();
RemoteData remoteData = message.getRemoteData();

try {
RemoteHandleWorker handleWorker = workerInstanceGetter.get(nextWorkerName);
if (handleWorker != null) {
AbstractWorker nextWorker = handleWorker.getWorker();
StreamData streamData = handleWorker.getStreamDataClass().newInstance();
RemoteHandleWorker handleWorker = workerInstanceGetter.get(nextWorkerName);
if (handleWorker != null) {
AbstractWorker nextWorker = handleWorker.getWorker();
StreamData streamData;
try {
streamData = handleWorker.getStreamDataClass().newInstance();
} catch (Throwable t) {
remoteInErrorCounter.inc();
LOGGER.error(t.getMessage(), t);
return;
}
try {
streamData.deserialize(remoteData);
nextWorker.in(streamData);
} else {
remoteInTargetNotFoundCounter.inc();
LOGGER.warn(
"Work name [{}] not found. Check OAL script, make sure they are same in the whole cluster.",
nextWorkerName
);
} catch (Throwable t) {
remoteInErrorCounter.inc();
LOGGER.error("Can't deserialize data {}, this data is discarded.", message, t);
return;
}
} catch (Throwable t) {
remoteInErrorCounter.inc();
LOGGER.error(t.getMessage(), t);
nextWorker.in(streamData);
} else {
remoteInTargetNotFoundCounter.inc();
LOGGER.warn(
"Data is discarded due to worker not found. Check OAL/MAL script, make sure they are aligned in the whole cluster. The data is {}",
message
);
}

} finally {
timer.finish();
}
Expand Down

0 comments on commit d98f74d

Please sign in to comment.