-
Notifications
You must be signed in to change notification settings - Fork 1.3k
[content-service] Refactor to use baseserver #9973
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
Conversation
445fb19
to
36dae42
Compare
fdc536b
to
e4a8f25
Compare
d603efd
to
73cb046
Compare
7c638e0
to
bdba136
Compare
2836760
to
c671645
Compare
From my testing on preview, this looks to be working but I'm lacking context on some flows which use the content service, so would appreciate help/direction on what needs to be validated. |
Storage StorageConfig `json:"storage"` | ||
} | ||
|
||
type TLSConfig struct { |
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.
TLS config is now part of baseserver
so using it directly.
Prometheus: config.Prometheus{ | ||
Addr: fmt.Sprintf(":%d", PrometheusPort), | ||
}, | ||
PProf: config.PProf{ |
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.
Wasn't used anywhere besides as a value passed into the server as config.
Service: config.Service{ | ||
Addr: fmt.Sprintf(":%d", RPCPort), | ||
}, | ||
Prometheus: config.Prometheus{ |
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's a default metrics port for each baseserver so using that instead.
contentService, err := service.NewContentService(cfg.Storage) | ||
if err != nil { | ||
log.WithError(err).Fatalf("cannot create content service") | ||
log.WithError(err).Fatalf("Cannot create content 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.
please leave this lowercase. The vast majority of our error messages is lowercase, and we should keep things consistent
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.
General practice in Go (and elsewhere) is to uppercase logs to make them sentences. They are designed to be consumed by humans and first letter uppercase is slightly easier to visually grep. Even our style guide uses first letter uppercase in logs https://github.com/uber-go/guide/blob/master/style.md#reduce-nesting
The change here is really just a drive by improvement to be more consistent with general practice.
Errors, on the other hand, should never start with an uppercase because they get wrapped and composed so don't really form sentences.
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.
Here's another reference from go code review style guide
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.
Fair point.
/hold cancel
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.
Sans nit, lgtm
/hold
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.
lgtm
Description
Refactors content service to use baseserver for server setup. Removes scattered config and allows us to normalize server setup across components.
Related Issue(s)
Similar to #10005
How to test
Content service runs in preview, unit tests pass
Release Notes
Documentation
NONE
/hold