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(tmc): send logs of the user-supplied command to Terramate Cloud. #1182

Merged
merged 2 commits into from
Oct 19, 2023

Conversation

i4ki
Copy link
Contributor

@i4ki i4ki commented Oct 16, 2023

Reasons for This Change

Terramate Cloud supports visualizing the deployment logs in real-time.

Description of the changes

A log syncer was created that proxies stdout/stderr writes using an in-memory pipe. The syncer creates 3 goroutines (1 for stdout, 1 for stderr and 1 for synchronizing logs) that MUST be shutdown/terminated after execution of each stack.
The syncer supports a customizable batchSize and maxLineSize but the requirement of the latter will be fixed in a separate PR.

@i4ki i4ki requested a review from a team as a code owner October 16, 2023 18:26
@netlify
Copy link

netlify bot commented Oct 16, 2023

Deploy Preview for terramate-io-docs canceled.

Name Link
🔨 Latest commit 9f028a4
🔍 Latest deploy log https://app.netlify.com/sites/terramate-io-docs/deploys/653120d86fe1410008b13876

@i4ki i4ki marked this pull request as draft October 16, 2023 18:26
@codecov
Copy link

codecov bot commented Oct 16, 2023

Codecov Report

Attention: 94 lines in your changes are missing coverage. Please review.

Comparison is base (5a4d973) 62.75% compared to head (d0ade01) 62.62%.
Report is 10 commits behind head on main.

❗ Current head d0ade01 differs from pull request most recent head 9f028a4. Consider uploading reports for the commit 9f028a4 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1182      +/-   ##
==========================================
- Coverage   62.75%   62.62%   -0.13%     
==========================================
  Files         102      103       +1     
  Lines       16395    16579     +184     
==========================================
+ Hits        10288    10383      +95     
- Misses       5683     5766      +83     
- Partials      424      430       +6     
Flag Coverage Δ
tests 62.62% <49.73%> (-0.13%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files Coverage Δ
cloud/cloud.go 40.66% <0.00%> (-2.91%) ⬇️
cloud/log_syncer.go 83.03% <83.03%> (ø)
cmd/terramate/cli/run.go 0.00% <0.00%> (ø)
cloud/types.go 31.03% <0.00%> (-7.82%) ⬇️

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@github-actions
Copy link

github-actions bot commented Oct 16, 2023

metric: time/op
ListFiles-2: old 154µs ± 9%: new 152µs ± 7%: delta: 0.00%
Generate-2: old 4.03s ± 3%: new 4.13s ± 4%: delta: 2.48%
GenerateRegex-2: old 2.52s ± 5%: new 2.53s ± 5%: delta: 0.00%
TokensForExpressionComplex-2: old 1.96ms ±14%: new 1.80ms ± 5%: delta: -8.07%
TokensForExpressionPlainStringNoNewline-2: old 1.40µs ± 8%: new 1.34µs ± 6%: delta: -4.30%
TokensForExpressionStringWith100Newlines-2: old 46.8µs ±14%: new 44.8µs ± 4%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-2: old 2.03ms ± 9%: new 2.02ms ± 6%: delta: 0.00%
TokensForExpression-2: old 1.82ms ± 8%: new 1.81ms ± 5%: delta: 0.00%
PartialEvalComplex-2: old 683µs ±13%: new 653µs ± 6%: delta: -4.25%
PartialEvalSmallString-2: old 5.46µs ± 7%: new 5.27µs ± 4%: delta: -3.62%
PartialEvalHugeString-2: old 2.84ms ± 4%: new 2.84ms ± 7%: delta: 0.00%
PartialEvalHugeInterpolatedString-2: old 7.35ms ± 4%: new 7.41ms ± 6%: delta: 0.00%
PartialEvalObject-2: old 32.6µs ± 4%: new 32.8µs ± 8%: delta: 0.00%
metric: alloc/op
ListFiles-2: old 99.4kB ± 0%: new 99.4kB ± 0%: delta: 0.00%
Generate-2: old 2.34GB ± 0%: new 2.34GB ± 0%: delta: 0.00%
GenerateRegex-2: old 953MB ± 0%: new 953MB ± 0%: delta: 0.00%
TokensForExpressionComplex-2: old 412kB ± 0%: new 412kB ± 0%: delta: -0.03%
TokensForExpressionPlainStringNoNewline-2: old 592B ± 0%: new 592B ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-2: old 14.0kB ± 0%: new 14.0kB ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-2: old 402kB ± 0%: new 402kB ± 0%: delta: 0.00%
TokensForExpression-2: old 412kB ± 0%: new 412kB ± 0%: delta: 0.00%
PartialEvalComplex-2: old 353kB ± 0%: new 353kB ± 0%: delta: 0.00%
PartialEvalSmallString-2: old 1.74kB ± 0%: new 1.74kB ± 0%: delta: 0.00%
PartialEvalHugeString-2: old 166kB ± 0%: new 166kB ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-2: old 4.38MB ± 0%: new 4.38MB ± 0%: delta: 0.00%
PartialEvalObject-2: old 20.4kB ± 0%: new 20.4kB ± 0%: delta: 0.00%
metric: allocs/op
ListFiles-2: old 474 ± 0%: new 474 ± 0%: delta: 0.00%
Generate-2: old 25.9M ± 0%: new 25.9M ± 0%: delta: 0.00%
GenerateRegex-2: old 18.3M ± 0%: new 18.3M ± 0%: delta: 0.00%
TokensForExpressionComplex-2: old 4.93k ± 0%: new 4.93k ± 0%: delta: -0.01%
TokensForExpressionPlainStringNoNewline-2: old 21.0 ± 0%: new 21.0 ± 0%: delta: 0.00%
TokensForExpressionStringWith100Newlines-2: old 328 ± 0%: new 328 ± 0%: delta: 0.00%
TokensForExpressionObjectWith100KeysWithNumberValues-2: old 3.29k ± 0%: new 3.29k ± 0%: delta: 0.00%
TokensForExpression-2: old 4.93k ± 0%: new 4.93k ± 0%: delta: 0.00%
PartialEvalComplex-2: old 2.83k ± 0%: new 2.83k ± 0%: delta: 0.00%
PartialEvalSmallString-2: old 23.0 ± 0%: new 23.0 ± 0%: delta: 0.00%
PartialEvalHugeString-2: old 35.0 ± 0%: new 35.0 ± 0%: delta: 0.00%
PartialEvalHugeInterpolatedString-2: old 23.1k ± 0%: new 23.1k ± 0%: delta: 0.00%
PartialEvalObject-2: old 125 ± 0%: new 125 ± 0%: delta: 0.00%

@i4ki i4ki force-pushed the i4k-send-logging branch 3 times, most recently from e7d9879 to c9312fa Compare October 17, 2023 09:46
@i4ki i4ki marked this pull request as ready for review October 17, 2023 09:51
# Reasons for This Change

Terramate Cloud supports visualizing the deployment logs in real-time.

## Description of the changes

A log syncer was created that proxies stdout/stderr writes using an in-memory pipe. The syncer creates 3 goroutines (1 for stdout, 1 for stderr and 1 for synchronizing logs) that *MUST* be shutdown/terminated after execution of each stack.
The syncer supports a customizable `batchSize` and `maxLineSize` but the requirement of the latter will be fixed in a separate PR.

Signed-off-by: Tiago Natel <t.nateldemoura@gmail.com>
@i4ki i4ki added this pull request to the merge queue Oct 19, 2023
Merged via the queue into main with commit 025d613 Oct 19, 2023
13 checks passed
@i4ki i4ki deleted the i4k-send-logging branch October 19, 2023 17:40
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