-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Publish PluginBroker pod events as runtime log (#15198)
Signed-off-by: Sergii Leshchenko <sleshche@redhat.com>
- Loading branch information
1 parent
6e0ce6d
commit 5a1344b
Showing
5 changed files
with
102 additions
and
15 deletions.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
...c/main/java/org/eclipse/che/workspace/infrastructure/kubernetes/RuntimeLogsPublisher.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
/* | ||
* Copyright (c) 2012-2018 Red Hat, Inc. | ||
* This program and the accompanying materials are made | ||
* available under the terms of the Eclipse Public License 2.0 | ||
* which is available at https://www.eclipse.org/legal/epl-2.0/ | ||
* | ||
* SPDX-License-Identifier: EPL-2.0 | ||
* | ||
* Contributors: | ||
* Red Hat, Inc. - initial API and implementation | ||
*/ | ||
package org.eclipse.che.workspace.infrastructure.kubernetes; | ||
|
||
import java.util.Set; | ||
import org.eclipse.che.api.core.model.workspace.runtime.RuntimeIdentity; | ||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEvent; | ||
import org.eclipse.che.workspace.infrastructure.kubernetes.namespace.event.PodEventHandler; | ||
import org.eclipse.che.workspace.infrastructure.kubernetes.util.RuntimeEventsPublisher; | ||
|
||
/** Listens pod events and publish them as runtime logs. */ | ||
public class RuntimeLogsPublisher implements PodEventHandler { | ||
|
||
private final RuntimeEventsPublisher eventPublisher; | ||
private final RuntimeIdentity runtimeIdentity; | ||
private final Set<String> pods; | ||
|
||
public RuntimeLogsPublisher( | ||
RuntimeEventsPublisher eventPublisher, RuntimeIdentity runtimeIdentity, Set<String> pods) { | ||
this.eventPublisher = eventPublisher; | ||
this.pods = pods; | ||
this.runtimeIdentity = runtimeIdentity; | ||
} | ||
|
||
@Override | ||
public void handle(PodEvent event) { | ||
final String podName = event.getPodName(); | ||
if (pods.contains(podName)) { | ||
eventPublisher.sendRuntimeLogEvent( | ||
event.getMessage(), event.getCreationTimeStamp(), runtimeIdentity); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters