cloudfoundry / cloudfoundry/cli

cf events: make returned item count and/or time span set able by command flags / arguments

Open
#2,084 3 comments 0 reactions 1 assignee View on GitHub

@a-b is already working on this.

Since Oct 1, 2024.

product-improvement
Dominant language
Go
Stars
1.9k
Forks
990
Avg merge
1d 7h
Merged PRs (30d)
8

Description

What's the user value of this feature request?

Developers and cloud admins can easily review app events in controlled manner. They can receive the needed set of events instead of a "random" (actually the last 50, what ever is recorded in these) subset.

Currently the first "page" (defaulting to fifty items) is returned, which might span a few minutes to days, depending on app activity. This does not allow investigating any specific problem with an app, unless it by chance falls within those last 50 events.

Who is the functionality for?
Mostly app developers, but also cloud operators.

How often will this functionality be used by the user?
While developing an app more or less frequently, depending of development and testing proceedings.

Who else is affected by the change?
This issue requests adding additions flags to the cf events command. It does not change existing behavior and so should not be able to break anything nor have any other negative impact on other users.

Is your feature request related to a problem? Please describe.
I am unable to review any app relate activity (pushes, starts/stops, crashes) outside the random time span that fits into the default first 50 lines from the event log. Specifically I had no simple way to figure out when an app started to frequently crash, restart and crash again.

Describe the solution you'd like
The cf events command should have optional arguments that allow to set the number of events to return. It should also gain options to specify the time span to return.

  • cf events APP_NAME [ --num-events <integer> ]
    return at most <interger> events from the event log, starting with the most recent event.
  • cf events APP_NAME [ --before <time specification> ]
    return the default number of events (or number given by --num-events) that happened strictly before the given time specification
  • cf events APP_NAME [ --after <time specification> ]
    return the default number of events (or number given by --num-events) that happened strictly after the given time specification, counting from the oldest event younger than <time specification> toward newer items

The <time specification> should follow usual format: yyyy-mm-dd HH:MM:SS

If both --before and --after are given, any additional --num-events should be ignored and the events in the given time span should be returned. Specifying an --after and --before time specification where the --after time specification newer than the --before time specification should be flagged as an error.

At least the first variant can probably be implemented with minimal changes, by passing an additional ccv3.PerPage parameter in line 32 of actor/v7action/event.go b/actor/v7action/event.go

Describe alternatives you've considered
I can not think of any alternative to achieve a similar result, i.e. ability to look a specific events for an app.

Additional context
No additional context.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.