|
159 | 159 | import org.cloudfoundry.logcache.v1.Log;
|
160 | 160 | import org.cloudfoundry.logcache.v1.LogCacheClient;
|
161 | 161 | import org.cloudfoundry.logcache.v1.ReadRequest;
|
| 162 | +import org.cloudfoundry.logcache.v1.ReadResponse; |
162 | 163 | import org.cloudfoundry.operations.util.OperationsLogging;
|
163 | 164 | import org.cloudfoundry.util.DateUtils;
|
164 | 165 | import org.cloudfoundry.util.DelayTimeoutException;
|
@@ -541,13 +542,13 @@ public Flux<Task> listTasks(ListApplicationTasksRequest request) {
|
541 | 542 | }
|
542 | 543 |
|
543 | 544 | @Override
|
544 |
| - public Flux<Log> logs(LogsRequest request) { |
| 545 | + public Flux<Log> logs(ReadRequest request) { |
545 | 546 | return Mono.zip(this.cloudFoundryClient, this.spaceId)
|
546 | 547 | .flatMap(
|
547 | 548 | function(
|
548 | 549 | (cloudFoundryClient, spaceId) ->
|
549 | 550 | getApplicationId(
|
550 |
| - cloudFoundryClient, request.getName(), spaceId))) |
| 551 | + cloudFoundryClient, request.getSourceId(), spaceId))) |
551 | 552 | .flatMapMany(
|
552 | 553 | applicationId ->
|
553 | 554 | getRecentLogs(this.logCacheClient, applicationId))
|
@@ -664,7 +665,6 @@ public Mono<Void> pushManifestV3(PushManifestV3Request request) {
|
664 | 665 | } catch (IOException e) {
|
665 | 666 | throw new RuntimeException("Could not serialize manifest", e);
|
666 | 667 | }
|
667 |
| - |
668 | 668 | return Mono.zip(this.cloudFoundryClient, this.spaceId)
|
669 | 669 | .flatMap(
|
670 | 670 | function(
|
@@ -1582,30 +1582,29 @@ private static int getInstances(AbstractApplicationResource resource) {
|
1582 | 1582 | .orElse(0);
|
1583 | 1583 | }
|
1584 | 1584 |
|
1585 |
| - /* private static Flux<Log> getLogs( |
1586 |
| - Mono<LogCacheClient> logCacheClient, String applicationId, Boolean recent) { |
| 1585 | + private static Flux<LogMessage> getLogs( |
| 1586 | + Mono<DopplerClient> dopplerClient, String applicationId, Boolean recent) { |
1587 | 1587 | if (Optional.ofNullable(recent).orElse(false)) {
|
1588 |
| - return getRecentLogs(logCacheClient, applicationId); |
| 1588 | + return requestLogsRecent(dopplerClient, applicationId) |
| 1589 | + .filter(e -> EventType.LOG_MESSAGE == e.getEventType()) |
| 1590 | + .map(Envelope::getLogMessage) |
| 1591 | + .collectSortedList(LOG_MESSAGE_COMPARATOR) |
| 1592 | + .flatMapIterable(d -> d); |
| 1593 | + } else { |
| 1594 | + return requestLogsStream(dopplerClient, applicationId) |
| 1595 | + .filter(e -> EventType.LOG_MESSAGE == e.getEventType()) |
| 1596 | + .map(Envelope::getLogMessage) |
| 1597 | + .transformDeferred( |
| 1598 | + SortingUtils.timespan(LOG_MESSAGE_COMPARATOR, LOG_MESSAGE_TIMESPAN)); |
1589 | 1599 | }
|
1590 |
| - }*/ |
| 1600 | + } |
1591 | 1601 |
|
1592 | 1602 | private static Flux<Log> getRecentLogs(Mono<LogCacheClient> logCacheClient, String applicationId) {
|
1593 | 1603 | return requestLogsRecentLogCache(logCacheClient, applicationId)
|
1594 |
| - .filter(e -> EnvelopeType.LOG.getValue().equals(e.getLog().getType().getValue())) |
1595 |
| - // .collectSortedList(LOG_MESSAGE_COMPARATOR_LOG_CACHE) |
1596 | 1604 | .sort(LOG_MESSAGE_COMPARATOR_LOG_CACHE)
|
1597 | 1605 | .map(org.cloudfoundry.logcache.v1.Envelope::getLog);
|
1598 | 1606 | }
|
1599 | 1607 |
|
1600 |
| -/* private static Flux<org.cloudfoundry.logcache.v1.Log> getRecentLogs(Mono<LogCacheClient> logCacheClient, String applicationId) { |
1601 |
| - return requestLogsRecentLogCache(logCacheClient, applicationId) |
1602 |
| - .filter(e -> EnvelopeType.LOG.getValue().equals(e.getLog().getType().getValue())) |
1603 |
| - .sort(LOG_MESSAGE_COMPARATOR_LOG_CACHE) |
1604 |
| - .map(org.cloudfoundry.logcache.v1.Envelope::getLog) |
1605 |
| - .collectList() |
1606 |
| - .flatMapIterable(d1 -> d1).cast(org.cloudfoundry.logcache.v1.Log.class); |
1607 |
| - } */ |
1608 |
| - |
1609 | 1608 | @SuppressWarnings("unchecked")
|
1610 | 1609 | private static Map<String, Object> getMetadataRequest(EventEntity entity) {
|
1611 | 1610 | Map<String, Optional<Object>> metadata =
|
|
0 commit comments