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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Retrieve the events list for a project for v2 #1307

Merged
merged 5 commits into from Aug 17, 2022
Merged

Retrieve the events list for a project for v2 #1307

merged 5 commits into from Aug 17, 2022

Conversation

boozec
Copy link
Contributor

@boozec boozec commented Aug 5, 2022

Sorry to re-open a PR for the same feat, but I can't re-open #1047. This PR adds

Manage events on Sentry.

USAGE:
    sentry-cli events [OPTIONS] <SUBCOMMAND>

OPTIONS:
        --auth-token <AUTH_TOKEN>    Use the given Sentry auth token.
    -h, --help                       Print help information
        --header <KEY:VALUE>         Custom headers that should be attached to all requests
                                     in key:value format.
        --limit <LIMIT>              Limit of requests [default: 10]
        --log-level <LOG_LEVEL>      Set the log output verbosity. [possible values: trace, debug,
                                     info, warn, error]
        --max-rows <MAX-ROWS>        Max of rows for a table.
    -o, --org <ORG>                  The organization slug
    -p, --project <PROJECT>          The project slug.
        --quiet                      Do not print any output while preserving correct exit code.
                                     This flag is currently implemented only for selected
                                     subcommands. [aliases: silent]
    -t, --tags                       Include tags into the list.
    -u, --user                       Include user's info into the list.

SUBCOMMANDS:
    help    Print this message or the help of the given subcommand(s)
    list    List all events in your organization.

As requested on this comment I added two flags:

  • limit is the limit of API requests
  • max_rows is the limit of events the table will print (default is all)

I'm not really sure about the last flag but I think it is the closets thing to "per-page" as cursor moves 100 items at a time.


@kamilogorek sorry if I could only work on it now but I was a bit busy 馃槄

Copy link
Contributor

@kamilogorek kamilogorek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll try to patch everything today

src/commands/events/mod.rs Show resolved Hide resolved
src/commands/events/list.rs Outdated Show resolved Hide resolved
src/api.rs Outdated
@@ -2307,6 +2351,81 @@ pub struct Project {
pub team: Option<Team>,
}

#[derive(Debug, Deserialize)]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already have all those types in sentry-sdk crate.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kamilogorek I found Event but I don't think you're talking about this one because it is not good for this JSON response.
For EventUser you were right because we can use sentry::protocol::User instead of EventUserOption.
For EventTags I suggest to keep the Vec<EventTag> due the JSON serialization. If we use the same way used for sentry-sdk we have to refactor tags in Vec<BTreeMap<String, String>> (or HashMap) but we always have a BTreeMap (or HashMap) with a tuple ("key", "...") and a ("value", "...") cause the nature of the response.

@kamilogorek kamilogorek enabled auto-merge (squash) August 17, 2022 12:44
@kamilogorek
Copy link
Contributor

Fixed everything, applied necessary changes and added basic cli tests. Thanks for your contribution!

@kamilogorek kamilogorek merged commit 7b84668 into getsentry:master Aug 17, 2022
viglia pushed a commit that referenced this pull request Sep 9, 2022
Co-authored-by: Kamil Og贸rek <kamil.ogorek@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants