Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime-v2: flush events on process error #1001

Merged
merged 1 commit into from
Oct 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -26,6 +26,7 @@
import com.walmartlabs.concord.client2.ProcessEventsApi;
import com.walmartlabs.concord.runtime.common.injector.InstanceId;
import com.walmartlabs.concord.runtime.v2.sdk.ProcessConfiguration;
import com.walmartlabs.concord.svm.ExecutionListener;
import com.walmartlabs.concord.svm.Frame;
import com.walmartlabs.concord.svm.Runtime;
import com.walmartlabs.concord.svm.State;
Expand All @@ -42,7 +43,7 @@
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;

public class DefaultEventReportingService implements EventReportingService {
public class DefaultEventReportingService implements EventReportingService, ExecutionListener {

private static final Logger log = LoggerFactory.getLogger(DefaultEventReportingService.class);

Expand Down Expand Up @@ -100,6 +101,12 @@ public void afterProcessEnds(Runtime runtime, State state, Frame lastFrame) {
flush();
}

@Override
public void onProcessError(Runtime runtime, State state, Exception e) {
flushScheduler.shutdown();
flush();
}

ProcessEventsApi getProcessEventsApi() {
return processEventsApi;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
Expand All @@ -23,11 +23,10 @@
import com.walmartlabs.concord.client2.ProcessEventRequest;
import com.walmartlabs.concord.svm.ExecutionListener;

public interface EventReportingService extends ExecutionListener {
public interface EventReportingService {

/**
* Report a process event to the server.
*/
void report(ProcessEventRequest req);

}
Original file line number Diff line number Diff line change
Expand Up @@ -73,10 +73,10 @@ protected void configure() {

Multibinder<ExecutionListener> executionListeners = Multibinder.newSetBinder(binder(), ExecutionListener.class);
executionListeners.addBinding().to(EventRecordingExecutionListener.class);
executionListeners.addBinding().to(EventReportingService.class);
executionListeners.addBinding().to(DefaultEventReportingService.class);
executionListeners.addBinding().to(MetadataProcessor.class);
executionListeners.addBinding().to(OutVariablesProcessor.class);
executionListeners.addBinding().to(SensitiveDataPersistenceService.class);
executionListeners.addBinding().to(StackTraceCollector.class);
}
}
}
Loading