Skip to content

Commit d33bf19

Browse files
committed
Revert default :included_environments to [:prod]
1 parent 57ab1d0 commit d33bf19

File tree

5 files changed

+15
-14
lines changed

5 files changed

+15
-14
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,14 @@
1212
- Removed `Sentry.Event.do_put_source_context/3`
1313
- Removed the `:async` value for the `:result` option in `Sentry.send_event/2` (and friends)
1414
- Removed `Sentry.CrashError` — now, crash reports (detected through `Sentry.LoggerBackend`) that do not contain exceptions are reported as *messages* in Sentry
15-
- Started accepting all environments by default by changing the default for the `:included_environments` configuration option from `[:prod]` to `:all`
1615
- Changed the shape of the `Sentry.Event` struct - check out the new fields (and typespec for `Sentry.Event.t/0`)
1716

1817
### Improvements
1918

2019
- Add `Sentry.LoggerHandler`, which is a `:logger` handler rather than a `Logger` backend
2120
- Make the `Sentry.HTTPClient.child_spec/0` callback optional
2221
- Add `:all` as a possible value of the `:metadata` configuration option for `Sentry.LoggerBackend`
22+
- Add `:all` as a possible value for the `:included_environment` configuration option
2323
- Add `Sentry.Interfaces` with all the child modules, which are useful if you're working directly with the Sentry API
2424

2525
### Deprecations

lib/sentry.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ defmodule Sentry do
3535
configuration file:
3636
3737
config :sentry, dsn: "https://public:[email protected]/1",
38-
included_environments: ["prod"],
38+
included_environments: [:prod],
3939
environment_name: config_env()
4040
4141
This will set the environment name to whatever the current environment

lib/sentry/config.ex

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,18 @@ defmodule Sentry.Config do
110110
end
111111

112112
def included_environments do
113-
Application.get_env(:sentry, :included_environments, :all)
113+
case Application.fetch_env(:sentry, :included_environments) do
114+
{:ok, :all} ->
115+
:all
116+
117+
{:ok, envs} when is_list(envs) ->
118+
string_envs = Enum.map(envs, &to_string/1)
119+
Application.put_env(:sentry, :included_environments, string_envs)
120+
string_envs
121+
122+
:error ->
123+
_default = ["prod"]
124+
end
114125
end
115126

116127
def environment_name do

pages/upgrade-9.x.md

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -98,16 +98,6 @@ The settings that are now *compile-time settings* are:
9898
* `:source_code_path_pattern`
9999
* `:source_code_exclude_patterns`
100100

101-
## Check Your Use of `:included_environments`
102-
103-
If you were relying on the default value for the `:included_environments` configuration option (which was `[:prod]`), then you'll need to make an adjustment. In v9.0.0, the default value is now `:all` (see [this issue](https://github.com/getsentry/sentry-elixir/issues/483) for some context). If you want to keep the old behavior, explicitly set this in your configuration:
104-
105-
```elixir
106-
# In config/config.exs
107-
config :sentry,
108-
included_environments: [:prod]
109-
```
110-
111101
## Stop Using `Sentry.Sources`
112102

113103
`Sentry.Sources` was meant to be private API and has been removed. Its functionality is very specific to Sentry, and it's not a good general mechanism to retrieve source code. This way, we can also have the freedom to improve this functionality without making potential breaking changes to the API of this library.

test/config_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ defmodule Sentry.ConfigTest do
3333
describe "included_environments" do
3434
test "retrieves from app env" do
3535
modify_env(:sentry, included_environments: [:test, :dev])
36-
assert [:test, :dev] == Config.included_environments()
36+
assert ["test", "dev"] == Config.included_environments()
3737
end
3838
end
3939

0 commit comments

Comments
 (0)