Skip to content

ApplicationEvent::getDescription always empty for crashes #875

@robachmann

Description

@robachmann

I'm trying to get a list of crashes (within a given amount of hours) for each application using the following lines of code:

Map<String, Map<String, Integer>> crashStatusCountMap = new LinkedHashMap<>();
List<ApplicationSummary> appSummary = cloudFoundryOperations.applications()
    .list()
    .toStream()
    .collect(Collectors.toList());

appSummary.forEach(
    application -> {
        Map<String, Integer> crashTypesPerApp = new LinkedHashMap<>();
        final GetApplicationEventsRequest request = GetApplicationEventsRequest
            .builder()
            .name(application.getName())
            .build();

        List<ApplicationEvent> crashEvents = cloudFoundryOperations.applications().getEvents(request).toStream()
            .filter(event -> LocalDateTime.ofInstant(event.getTime().toInstant(), ZoneId.systemDefault())
                .plusHours(hours)
                .isAfter(LocalDateTime.now()))
            .filter(event -> event.getActor().equalsIgnoreCase("web") && event.getEvent().contains("crash"))
            .collect(Collectors.toList());

        crashEvents.forEach(crash -> {
            String event = crash.getEvent();
            String actor = crash.getActor();
            String description = crash.getDescription();
            String id = crash.getId();
            Date time = crash.getTime();

            String reason = crash.getDescription();
                Integer integer = crashTypesPerApp.getOrDefault(reason, 0);
                crashTypesPerApp.put(reason, integer + 1);
            }
        );

        crashStatusCountMap.put(application.getName(), crashTypesPerApp);
    });

return crashStatusCountMap;

Unfortunately, crash.getDescription() is always empty, even though I see a description when using the CF web console, e.g.:

index: 4
exit_status: undefined
exit_description: Instance became unhealthy: Failed to make HTTP request to '/health' on port 8080: connection refused (out of memory); APP/PROC/WEB: Exited with status 137 (out of memory)
reason: CRASHED

used versions are:

compile 'org.cloudfoundry:cloudfoundry-client-reactor:3.8.0.RELEASE'
compile 'org.cloudfoundry:cloudfoundry-operations:3.8.0.RELEASE'
compile 'io.projectreactor:reactor-core:3.1.2.RELEASE'
compile 'io.projectreactor.ipc:reactor-netty:0.7.2.RELEASE'

with CF API 2.106.0

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions