-
Notifications
You must be signed in to change notification settings - Fork 0
feat: add live logs #312
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
base: 2.x.x
Are you sure you want to change the base?
feat: add live logs #312
Conversation
6a45e15
to
8fde14a
Compare
fbb7d48
to
567e7f2
Compare
internal/service/logs.go
Outdated
if response != nil { | ||
for _, logMessage := range response.Logs { | ||
fmt.Println(logMessage.GetMessage()) | ||
lastLogTime = logMessage.GetTimestamp() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
what if this comes out of order? the lastLogTime will be updated to something before the actual lastLogTime
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ordering is guaranteed from deployer. But still, we can add >
logic to prevent this
internal/service/service.go
Outdated
} | ||
} | ||
attempts++ | ||
time.Sleep(5 * time.Second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
do we need to sleep even if there's no error?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sleep is to prevent burst retry if no logs are present for some time.
internal/service/service.go
Outdated
log.Info("Fetching live logs...") | ||
} | ||
select { | ||
case <-streamCtx.Done(): // Listen for cancellation signal |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
does cancel
also send a Done
signal?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, this here sends the done signal
Signed-off-by: surajgour-d11 <[email protected]>
3afcb92
to
2e83084
Compare
Signed-off-by: surajgour-d11 <[email protected]>
2e83084
to
ea7f208
Compare
Signed-off-by: surajgour-d11 <[email protected]>
e2555aa
to
669fe76
Compare
internal/service/logs.go
Outdated
if logStreamErr != nil { | ||
if errors.Is(logStreamErr, context.Canceled) || logStreamErr == io.EOF { | ||
break | ||
} else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
else can be removed here
"VALIDATE": {"FAILED": true}, | ||
} | ||
|
||
var RetryableStatusCodes = []codes.Code{codes.DeadlineExceeded, codes.Canceled, codes.Unavailable} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is one more. codes.Internal AND description contains "stream terminated by RST_STREAM"
internal/service/service.go
Outdated
var re retryable.Error | ||
if errors.As(err, &re) { | ||
if re.Retryable() { | ||
log.Info("Connection with backend server lost. Retrying...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i think it was agreed that "Connection with backend server lost." will only come first time. On subsequent retries ,Retrying... should be printed. lets check this with DC once
* chore: refractoring Signed-off-by: surajgour-d11 <[email protected]> * chore: refractoring Signed-off-by: surajgour-d11 <[email protected]> --------- Signed-off-by: surajgour-d11 <[email protected]>
// DeployService deploys service | ||
func (e *Service) DeployService(ctx *context.Context, request *serviceProto.DeployServiceRequest) error { | ||
log.Info("Deploying Service...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are we not doing this for operate service/component and deploy released service ?
Signed-off-by: surajgour-d11 <[email protected]>
Odin version(x.y.z)
Features
Resources