Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Send correct logs to Saturn logger #40

Merged
merged 3 commits into from
Feb 23, 2023
Merged

Send correct logs to Saturn logger #40

merged 3 commits into from
Feb 23, 2023

Conversation

aarshkshah1992
Copy link
Contributor

@aarshkshah1992 aarshkshah1992 commented Feb 21, 2023

Fixes #38.

  • Investigate with @guanzo why Saturn logger is returning 400 with the correct format and JWT.
  • @guanzo to share the testnet and mainnet logging URLs and JWT with @lidel.
  • Actually see a 200 from the testnet and mainnet logging servers before we merge this branch.

@@ -84,5 +85,6 @@ func main1() int {
log.Println(err)
return 1
}
time.Sleep(5 * time.Second)
Copy link
Contributor

Choose a reason for hiding this comment

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

why do we need this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was for some debugging to ensure that we do eventually see the response of the logging endpoint before shutting down. Lemme remove this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed.

Copy link
Contributor

Choose a reason for hiding this comment

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

@aarshkshah1992 but.. did you push the removal? 🙃 I still see it :D

log.go Outdated
Comment on lines 72 to 75
req.Header.Set("Content-Type", "application/json")
req.Header.Set("Authorization", fmt.Sprintf("Bearer %s", l.jwt))

resp, err := l.client.Do(req)
Copy link
Contributor

Choose a reason for hiding this comment

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

rather than having this a specific saturn logging needs a jwt bearer token - which is a pretty different level of abstraction than the rest of this library so far - i wonder if we can have this header set by the configured http client.

so e.g. we set the specific client/url at https://github.com/ipfs/bifrost-gateway/blob/main/blockstore.go#L111
we could do something like the final code block at https://developer20.com/add-header-to-every-request-in-go/ to configure the JWT token in the same place, which seems more local than splitting it between there and here.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I have removed this token from the config.

caboose.go Outdated
Comment on lines 71 to 73
if config.SaturnLoggerJWT == "" || len(config.SaturnLoggerJWT) == 0 {
return nil, errors.New("JWT token required for Saturn Logger")
}
Copy link
Contributor

@lidel lidel Feb 22, 2023

Choose a reason for hiding this comment

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

⚠️ this breaks flow for local development OR requires everyone on the team to get their own token.
iiurc last time we talked about this @guanzo noted it is ok to simply disable sending logs to logger when JWT token is not set.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done.

pool.go Show resolved Hide resolved
pool.go Outdated Show resolved Hide resolved
@aarshkshah1992
Copy link
Contributor Author

Filed ipfs/bifrost-gateway#51 for Bifrost to make the required changes.

@aarshkshah1992
Copy link
Contributor Author

@willscott @lidel Don't worry about the failing CI test here. Has already been fixed in #39.

@willscott
Copy link
Contributor

@aarshkshah1992 - the top of the PR indicates we're waiting to see a 200 response from log ingester. what needs to happen there / should we merge and tag this now?

@aarshkshah1992
Copy link
Contributor Author

@willscott Merging this as there's some config work that needs to happen on Bifrost to test this end -end. Work captured at ipfs/bifrost-gateway#51.

@aarshkshah1992 aarshkshah1992 merged commit b5a61bc into main Feb 23, 2023
@aarshkshah1992 aarshkshah1992 deleted the fix/saturn-logs branch February 23, 2023 03:37
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Saturn logging fixes
4 participants