ForzaElixir / rollbax

Exception tracking and logging from Elixir to Rollbar
https://hexdocs.pm/rollbax
ISC License
243 stars 52 forks source link

Configure Rollbax in different apps in an umbrella project #84

Closed MeterSoft closed 6 years ago

MeterSoft commented 6 years ago

It is possible use config like this config :app_name, :rollbax, access_token: "123" I use it only for one app in umbrella project and wont to add this to deps only for this project. if set just config :rollbar i need to add rollbar to all projects

ericmj commented 6 years ago

You should be able to add the config to only the app that uses rollbar.

MeterSoft commented 6 years ago

yes, i added it to umbrella app ../apps/app_1/config/ but when i compile app_2 it load all config file import_config "../apps/*/config/config.exs" so two configs are merged and it is not possible to setup different rollbar

ericmj commented 6 years ago

Do you want to configure and report to multiple rollbar instances?

When I set up a test umbrella project with rollbax as dependency and configure it in one of the child apps everything seems to work when I run from any of the apps or the root. Can you show the error you are getting?

MeterSoft commented 6 years ago

app1/config config :rollbax, access_token: "aaa", environment: "production"

app2/config config :rollbax, access_token: "bbb", environment: "production"

then from main folder mix release --env=prod --name=app1 in this case app1 will have setting from app2

if before run mix release --env=prod --name=app1 go to apps/app1 and then run mix release --env=prod --name=app1 it will have correct setting

MeterSoft commented 6 years ago

for example for logger i can do next config :logger, backends: [{LoggerFileBackend, :app1}]

config :logger, :app1, level: :debug, metadata_filter: [aplication: :app1]

ericmj commented 6 years ago

You can't have different rollbar reporting for different applications, since the logger (or error reporter in 0.9) is global for your release. Because of this you have to select a single rollbax configuration you want use.

Having a configuration option such as config :app_name, :rollbax, access_token: "123" would not not help because at some point you still have to select a single configuration to use.

whatyouhide commented 6 years ago

@MeterSoft Eric is right, Logger being global prevents us to have multiple Rollbax applications. One thing we could do is support different Rollbax backends, and then you could have different filters for each backend, but it would be hard to filter by application, so there's no plan to support that for now.