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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(metrics): Add send-metric command #2063

Merged
merged 4 commits into from
May 27, 2024
Merged

feat(metrics): Add send-metric command #2063

merged 4 commits into from
May 27, 2024

Conversation

elramen
Copy link
Contributor

@elramen elramen commented May 14, 2024

Add CLI command send-metric for emitting metrics to Sentry.
Add new command-parser that uses clap's Derive API. Future commands should use this as the Derive API makes it:
-Easier to read, write, and modify arguments and commands.
-Easier to keep the argument declaration and reading of argument in sync.
-Easier to reuse shared arguments.

Fixes GH-2001

@elramen elramen force-pushed the elias-send-metric branch 2 times, most recently from b40f9ce to 1a39b52 Compare May 14, 2024 14:27
@elramen elramen requested a review from iambriccardo May 14, 2024 14:30
package.json Outdated Show resolved Hide resolved
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

I have only reviewed some of the files. Will continue reviewing the rest later

src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/errors/api_error.rs Outdated Show resolved Hide resolved
src/commands/send_metric/mod.rs Show resolved Hide resolved
src/commands/send_metric/mod.rs Outdated Show resolved Hide resolved
src/commands/send_metric/mod.rs Show resolved Hide resolved
src/commands/send_metric/set.rs Outdated Show resolved Hide resolved
src/utils/metrics/arg_parsers.rs Outdated Show resolved Hide resolved
@elramen elramen force-pushed the elias-send-metric branch 2 times, most recently from 26ee405 to d7b0ba8 Compare May 15, 2024 12:27
@szokeasaurusrex
Copy link
Member

szokeasaurusrex commented May 15, 2024

Please also remember to rename this PR to "feat(metrics): ..."

@elramen elramen changed the title feat(commands): add send-metric command feat(metrics): add send-metric command May 15, 2024
src/utils/metrics/arg_parsers.rs Outdated Show resolved Hide resolved
src/utils/metrics/mod.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_key.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_payload.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_payload.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_payload.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_payload.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_tags.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_tags.rs Outdated Show resolved Hide resolved
@elramen elramen force-pushed the elias-send-metric branch 2 times, most recently from b19bcb9 to 4815045 Compare May 15, 2024 19:11
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

Another partial review – I think I checked everything besides the integration tests. Mostly small changes/nitpicks, but I did find a bug related to string indexing which will need to be fixed

CONTRIBUTING.md Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/commands/send_metric/set.rs Outdated Show resolved Hide resolved
src/commands/send_metric/set.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_tags.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_tags.rs Outdated Show resolved Hide resolved
src/utils/metrics/normalized_payload.rs Outdated Show resolved Hide resolved
@elramen elramen requested a review from sl0thentr0py May 16, 2024 13:04
@elramen elramen force-pushed the elias-send-metric branch 2 times, most recently from 7bf8519 to 7cafaaf Compare May 16, 2024 14:30
Copy link
Member

@iambriccardo iambriccardo left a comment

Choose a reason for hiding this comment

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

LGTM, I will leave the approval to Daniel since I don't have all the CLI context I would need to properly review this PR.

src/api/envelopes_api.rs Outdated Show resolved Hide resolved
Copy link
Member

@szokeasaurusrex szokeasaurusrex left a comment

Choose a reason for hiding this comment

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

I added some comments, and requested some changes, primarily related to adding clearer user-facing documentation. This time, I looked through all the files (including integration tests) – some of the changes I requested are in the files changed for the integration tests.

Overall, this PR seems to be coming together really well, and the code looks overall very good!

src/api/envelopes_api.rs Outdated Show resolved Hide resolved
src/api/errors/api_error.rs Show resolved Hide resolved
src/api/errors/api_error.rs Outdated Show resolved Hide resolved
src/commands/send_metric/set.rs Outdated Show resolved Hide resolved
src/commands/send_metric/set.rs Outdated Show resolved Hide resolved
tests/integration/mod.rs Show resolved Hide resolved
tests/integration/mod.rs Outdated Show resolved Hide resolved
tests/integration/mod.rs Show resolved Hide resolved
tests/integration/mod.rs Outdated Show resolved Hide resolved
tests/integration/mod.rs Outdated Show resolved Hide resolved
@elramen elramen force-pushed the elias-send-metric branch 4 times, most recently from 006ead9 to a716176 Compare May 27, 2024 15:43
Elias Ram added 2 commits May 27, 2024 18:05
Copy link
Member

@sl0thentr0py sl0thentr0py left a comment

Choose a reason for hiding this comment

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

just a couple of comments, rest looks good

src/utils/value_parsers.rs Outdated Show resolved Hide resolved
src/commands/derive_parser.rs Show resolved Hide resolved
@elramen elramen changed the title feat(metrics): add send-metric command feat(metrics): Add send-metric command May 27, 2024
@elramen elramen merged commit c805e5c into master May 27, 2024
12 checks passed
@elramen elramen deleted the elias-send-metric branch May 27, 2024 18:39
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.

Add ability to send metrics via sentry-cli
4 participants