-
Notifications
You must be signed in to change notification settings - Fork 4
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: read config from file #383
Conversation
@phacops do I need to write changelog or do you need to discuss this internally? |
Maybe @bmckerry knows where to your this PR for review? |
This would be very nice to see, it would make it very simple for self-hosted to for example store profiles in bucket storage instead of on disk! |
Hi @aldy505, Sorry for the delay! It seems like this PR will now require us to ship a config file while still being able to override it via environment variables. Why is this needed versus shipping a |
@phacops It's much easier to do configuration by using file instead of environment variables for self-hosted. Also the current state of self-hosted configuration services are using configuration files instead of just bare environment variable (although environment variables are still in place).
Modifying |
I understand how it'll make this easier to have a separate file with your environment variables. I think we could still have this but without having to add anything to We could add to the This way, we don't need to modify Here is what I'm suggesting: getsentry/self-hosted#2866 |
I disagree with the Obviously the changes doesn't requires everyone to immediately change to the config file. It's still backward compatible. But what I'm aiming for is that people can have the same configuration structure as with the other services, and it'll make self-hosted maintenance a lot easier for the OSPO team. It's also a good way to provide documentation on how to configure vroom as a running service. Maintaining service configuration on the develop docs site is not friendly if they're using older releases, the website doesn't show the CalVer versions. |
I don't really see what's easier with a separate YAML file. We still have to load the configuration via Docker Compose (like https://github.com/getsentry/self-hosted/blob/master/docker-compose.yml#L309-L314) or on Kubernetes. What I could do to make it more compatible is to source the As for the configuration documentation, is reading a YAML file so much better than a Go struct? The only argument in the favor is doing this is "other services are doing it that way" but everything else seems more complicated and less integrated with existing tools. |
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 understand having the same way to configure all Sentry services is useful even if I don't agree.
I think we can merge your contribution if you fix the few comments I have. I'll make the necessary changes in self-hosted
to accomodate that after.
cmd/vroom/config.go
Outdated
OccurrencesKafkaBrokers []string `env:"SENTRY_KAFKA_BROKERS_OCCURRENCES" yaml:"kafka_brokers" env-default:"localhost:9092"` | ||
OccurrencesKafkaTopic string `env:"SENTRY_KAFKA_TOPIC_OCCURRENCES" yaml:"kafka_topic" env-default:"ingest-occurrences"` |
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 remove the Occurrences
prefix from the name.
|
||
Logging struct { | ||
Level string `env:"SENTRY_LOGGING_LEVEL" yaml:"level" env-default:"info"` | ||
Format string `env:"SENTRY_LOGGING_FORMAT" yaml:"format" env-default:"simplified"` |
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.
Let's remove this since we only have 1 format so far.
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.
It can be json
(default) or simplified
(for human readable)
cmd/vroom/config.go
Outdated
CallTreesKafkaTopic string `env:"SENTRY_KAFKA_TOPIC_CALL_TREES" env-default:"profiles-call-tree"` | ||
ProfilesKafkaTopic string `env:"SENTRY_KAKFA_TOPIC_PROFILES" env-default:"processed-profiles"` | ||
Profiling struct { | ||
ProfilingKafkaBrokers []string `env:"SENTRY_KAFKA_BROKERS_PROFILING" yaml:"kafka_brokers" env-default:"localhost:9092"` |
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.
Let's remove the Profiling
prefix from this too.
cmd/vroom/main.go
Outdated
@@ -50,9 +52,16 @@ const ( | |||
|
|||
func newEnvironment() (*environment, error) { | |||
var e environment | |||
err := cleanenv.ReadEnv(&e.config) | |||
err := cleanenv.ReadConfig("config.yml", &e.config) |
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 would prefer not to hardcode the filename and make it an argument like other services.
Chiming in here, the reason why symbolicator and relay have these yml config files is due to a design choice for those services. If @phacops believes that this is not the best approach for configuring vroom and prefers loading in variables from the env, I don't think we should go forwards with using a yml config file for customizing self-hosted. Having said that, the proposed |
We're not going to implement reading configuration from files. |
Closes #382
Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.