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: enable job logs command #3794

Merged
merged 22 commits into from Aug 11, 2022
Merged

feat: enable job logs command #3794

merged 22 commits into from Aug 11, 2022

Conversation

bvtujo
Copy link
Contributor

@bvtujo bvtujo commented Jul 18, 2022

  • chore: update cloudwatchlogs to allow limiting log streams fetched and custom prefixes
  • chore: add logic for fetching state machine logs to workload
  • chore: add unit tests for workload logging pkg
  • chore: make things work for ci
  • chore: address feedback
  • feat: add job logs logic
  • chore: add logic in underlying libraries for job logs (chore: add logic in underlying libraries for job logs #3757)
  • fix logic bugs in log stream sorting
  • chore: make IncludeStateMachine a logging option, not a struct member
  • feat: enable job logs command and add tests

Adds job logs command and fixes a bug which randomized the sort order of log streams.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.

bvtujo added 10 commits July 18, 2022 16:06
use pagination for log stream fetching.
rename variables.
make sure log stream truncation and filtering are engaged in tests.
feat: enable command

test: add job logs ask and validate tests; rename svcAppNameHelpPrompt

chore: add execute tests
- chore: add job logs logic and validation
- chore: update cloudwatchlogs to allow limiting log streams fetched and custom prefixes
- chore: rename service.go to workload.go in logging pkg
- chore: add logic for fetching state machine logs to workload
- chore: add unit tests for workload logging pkg

Adds unit tests and changes for the cloudwatchlogs and logging libraries necessary for job logs, specifically for getting one or N executions at a time, optionally including state machine logs.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the Apache 2.0 License.
@bvtujo bvtujo requested a review from a team as a code owner July 18, 2022 20:36
@bvtujo bvtujo requested review from dannyrandall and removed request for a team July 18, 2022 20:36
@efekarakus efekarakus added do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. and removed do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. labels Jul 18, 2022
internal/pkg/aws/cloudwatchlogs/cloudwatchlogs.go Outdated Show resolved Hide resolved
internal/pkg/cli/job_logs.go Outdated Show resolved Hide resolved
internal/pkg/cli/job_logs.go Show resolved Hide resolved
internal/pkg/cli/cli.go Show resolved Hide resolved
internal/pkg/aws/cloudwatchlogs/cloudwatchlogs.go Outdated Show resolved Hide resolved
internal/pkg/aws/cloudwatchlogs/cloudwatchlogs.go Outdated Show resolved Hide resolved
internal/pkg/cli/job_logs.go Outdated Show resolved Hide resolved
site/content/docs/commands/job-logs.en.md Show resolved Hide resolved
site/content/docs/concepts/jobs.en.md Outdated Show resolved Hide resolved
internal/pkg/cli/job_logs.go Outdated Show resolved Hide resolved
site/content/docs/commands/job-logs.en.md Outdated Show resolved Hide resolved
Comment on lines 173 to 174
require.Equal(t, param.LogStreamPrefixFilters, []string{"copilot/", "states"})
require.Equal(t, param.Limit, aws.Int64(10))
require.Equal(t, param.LogStreamLimit, 2)
Copy link
Contributor

Choose a reason for hiding this comment

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

are we still interested in what's passed in param.Limit? If so, what do you think of

require.Equal(t, param.LogStreamPrefixFilters, []string{"copilot/", "states"})
require.Equal(t, param,Limit aws.Int(10))
require.Equal(t, param.LogStreamLimit, 2)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good idea; i've added a check here and a new test to ensure that some log stream limit behavior is working properly.

@iamhopaul123 iamhopaul123 added the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Aug 11, 2022
bvtujo and others added 4 commits August 11, 2022 14:07
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
Co-authored-by: Wanxian Yang <79273084+Lou1415926@users.noreply.github.com>
@bvtujo bvtujo requested a review from Lou1415926 August 11, 2022 18:59
@Lou1415926 Lou1415926 added do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. and removed do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. labels Aug 11, 2022
Copy link
Contributor

@Lou1415926 Lou1415926 left a comment

Choose a reason for hiding this comment

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

LGTM! Feel free to remove the label when you are ready (I did it but then added it back just in case you wanted to add anything)

@bvtujo bvtujo removed the do-not-merge Pull requests that mergify shouldn't merge until the requester allows it. label Aug 11, 2022
@mergify mergify bot merged commit d485f40 into mainline Aug 11, 2022
Sprint 🏃‍♀️ automation moved this from In review to Pending release Aug 11, 2022
@mergify mergify bot deleted the job-logs branch August 11, 2022 20:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Sprint 🏃‍♀️
  
Pending release
Development

Successfully merging this pull request may close these issues.

None yet

5 participants