-
-
Notifications
You must be signed in to change notification settings - Fork 202
Fix for OTP 28 #891
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
base: master
Are you sure you want to change the base?
Fix for OTP 28 #891
Conversation
Thank you for the PR - why do we need this change though? I thought only regexps no longer work as module attributes. |
I think functions in general are no longer supported, and regexes get compiled to functions? Ah, actually the compile error makes it clear: |
@mayel are you saying this is the error that you get when you try to compile on OTP 28? |
Yeah the full error looked similar to the one here: jonasschmidt/ex_json_schema#93 |
@valid_keys Keyword.keys(@raw_opts_schema) | ||
|
||
defp opts_schema do: NimbleOptions.new!(@raw_opts_schema) | ||
|
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.
@mayel this is a syntax error
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.
Oops sorry, did that quickly using github's editor. Can fix in a bit.
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.
done
If this is not the same issue, then we should solve it like this: #889 |
@whatyouhide in #889 a regexp caused the issue, here it seems like having a custom |
It shouldn't. The issue is likely some value in that struct, which we should approach like we did for #889. |
Hmm I don't see any regexp here: iex> Sentry.Config.opts_schema()
%NimbleOptions{
schema: [
dsn: [
required: false,
type: {:or, [nil, {:custom, Sentry.DSN, :parse, []}]},
default: nil,
type_doc: "`t:String.t/0` or `nil`",
doc: "The DSN for your Sentry project. If this is not set, Sentry will not be enabled.\nIf the `SENTRY_DSN` environment variable is set, it will be used as the default value.\nIf `:test_mode` is `true`, the `:dsn` option is sometimes ignored; see `Sentry.Test`\nfor more information.\n"
],
environment_name: [
required: false,
type: {:or, [:string, :atom]},
type_doc: "`t:String.t/0` or `t:atom/0`",
default: "production",
doc: "The current environment name. This is used to specify the environment\nthat an event happened in. It can be any string shorter than 64 bytes,\nexcept the string `\"None\"`. When Sentry receives an event with an environment,\nit creates that environment if it doesn't exist yet.\nIf the `SENTRY_ENVIRONMENT` environment variable is set, it will\nbe used as the value for this option.\n"
],
traces_sample_rate: [
required: false,
type: {:custom, Sentry.Config, :__validate_traces_sample_rate__, []},
default: 0.0,
doc: "The sample rate for transaction events. A value between `0.0` and `1.0` (inclusive).\nA value of `0.0` means no transactions will be sampled, while `1.0` means all transactions\nwill be sampled. This value is also used to determine if tracing is enabled: if it's\ngreater than `0`, tracing is enabled.\n\nTracing requires OpenTelemetry packages to work. See [the\nOpenTelemetry setup documentation](https://opentelemetry.io/docs/languages/erlang/getting-started/)\nfor guides on how to set it up.\n"
],
included_environments: [
required: false,
type: {:or, [in: [:all], list: {:or, [:atom, :string]}]},
deprecated: "Use :dsn to control whether to send events to Sentry.",
type_doc: "list of `t:atom/0` or `t:String.t/0`, or the atom `:all`",
doc: "**Deprecated**. The environments in which Sentry can report events. If this is a list,\nthen `:environment_name` needs to be in this list for events to be reported.\nIf this is `:all`, then Sentry will report events regardless of the value\nof `:environment_name`. *This will be removed in v11.0.0*.\n"
],
release: [
required: false,
type: {:or, [:string, nil]},
default: nil,
type_doc: "`t:String.t/0` or `nil`",
doc: "The release version of your application.\nThis is used to correlate events with source code. If the `SENTRY_RELEASE`\nenvironment variable is set, it will be used as the default value.\n"
],
json_library: [
required: false,
type: {:custom, Sentry.Config, :__validate_json_library__, []},
type_doc: "`t:module/0`",
default: JSON,
doc: "A module that implements the \"standard\" Elixir JSON behaviour, that is, exports the\n`encode/1` and `decode/1` functions.\n\nDefaults to `Jason` if the `JSON` kernel module is not available (it was introduced\nin Elixir 1.18.0). If you use the default configuration with Elixir version lower than\n1.18, this option will default to `Jason`, but you will have to add\n[`:jason`](https://hexa.pm/packages/jason) as a dependency of your application.\n"
],
send_client_reports: [
required: false,
type: :boolean,
default: true,
doc: "Send diagnostic client reports about discarded events, interval is set to send a report\nonce every 30 seconds if any discarded events exist.\nSee [Client Reports](https://develop.sentry.dev/sdk/client-reports/) in Sentry docs.\n*Available since v10.8.0*.\n"
],
server_name: [
required: false,
type: :string,
doc: "The name of the server running the application. Not used by default.\n"
],
sample_rate: [
required: false,
type: {:custom, Sentry.Config, :__validate_sample_rate__, []},
default: 1.0,
type_doc: "`t:float/0`",
doc: "The percentage of events to send to Sentry. A value of `0.0` will deny sending any events,\nand a value of `1.0` will send 100% of events. Sampling is applied\n**after** the `:before_send` callback. See where [the Sentry\ndocumentation](https://develop.sentry.dev/sdk/sessions/#filter-order)\nsuggests this. Must be between `0.0` and `1.0` (included).\n"
],
tags: [
required: false,
type: {:map, :any, :any},
default: %{},
doc: "A map of tags to be sent with every event.\n"
],
extra: [
required: false,
type: {:map, :atom, :any},
type_doc: "`t:Sentry.Context.extra/0`",
default: %{},
doc: "A map of extra data to be sent with every event.\n"
],
max_breadcrumbs: [
required: false,
type: :non_neg_integer,
default: 100,
doc: "The maximum number of breadcrumbs to keep. See `Sentry.Context.add_breadcrumb/1`.\n"
],
report_deps: [
required: false,
type: :boolean,
default: true,
doc: "Whether to report application dependencies of your application\nalongside events. This list contains applications (alongside their version)\nthat are **loaded** when the `:sentry` application starts.\n"
],
log_level: [
required: false,
type: {:in, [:debug, :info, :warning, :warn, :error]},
default: :warning,
doc: "The level to use when Sentry fails to\nsend an event due to an API failure or other reasons.\n"
],
filter: [
required: false,
type: :atom,
type_doc: "`t:module/0`",
default: Sentry.DefaultEventFilter,
doc: "A module that implements the `Sentry.EventFilter`\nbehaviour. Defaults to `Sentry.DefaultEventFilter`. See the\n[*Filtering Exceptions* section](#module-filtering-exceptions) below.\n"
],
dedup_events: [
required: false,
type: :boolean,
default: true,
doc: "Whether to **deduplicate** events before reporting them to Sentry. If this option is `true`,\nthen the SDK will store reported events for around 30 seconds after they're reported.\nAny time the SDK is about to report an event, it will check if it has already reported\nwithin the past 30 seconds. If it has, then it will not report the event again, and will\nlog a message instead. Events are deduplicated by comparing their message, exception,\nstacktrace, and fingerprint. *Available since v10.0.0*.\n"
],
test_mode: [
required: false,
type: :boolean,
default: false,
doc: "Whether to enable *test mode*. When test mode is enabled, the SDK will check whether\nthere is a process **collecting events** and avoid sending those events if that's the\ncase. This is useful for testing—see `Sentry.Test`. `:test_mode` works in tandem\nwith `:dsn`; this is described in detail in `Sentry.Test`.\n"
],
integrations: [
required: false,
type: :keyword_list,
doc: "Configuration for integrations with third-party libraries. Every integration has its own\noption and corresponding configuration options.\n",
default: [],
keys: [
max_expected_check_in_time: [
required: false,
type: :integer,
default: 600000,
doc: "The time in milliseconds that a check-in ID will live after it has been created.\n\nThe SDK reports the start and end of each check-in. A check-in is used to track the\nprogress of a specific check-in event associated with cron job telemetry events that are a part\nof the same job. However, to optimize performance and prevent potential memory issues,\nif a check-in end event is reported after the specified `max_expected_check_in_time`,\nthe SDK will not report it. This behavior helps manage resource usage effectively while still\nproviding necessary tracking for your jobs.\n*Available since 10.6.3*.\n"
],
monitor_config_defaults: [
required: false,
type: :keyword_list,
default: [],
doc: "Defaults to be used for the `monitor_config` when reporting cron jobs with one of the\nintegrations. This supports all the keys defined in the [Sentry\ndocumentation](https://develop.sentry.dev/sdk/telemetry/check-ins/#monitor-upsert-support).\nSee also `Sentry.CheckIn.new/1`. *Available since v10.8.0*.\n"
],
oban: [
required: false,
type: :keyword_list,
doc: "Configuration for the [Oban](https://github.com/sorentwo/oban) integration. The Oban\nintegration requires at minumum Oban Pro v0.14 or Oban v.2.17.6. *Available\nsince v10.2.0*.\n",
keys: [
capture_errors: [
required: false,
type: :boolean,
default: false,
doc: "Whether to capture errors from Oban jobs. When enabled, the Sentry SDK will capture\nerrors that happen in Oban jobs, including when errors return `{:error, reason}`\ntuples. *Available since 10.3.0*.\n"
],
cron: [
required: false,
doc: "Configuration options for configuring [*crons*](https://docs.sentry.io/product/crons/)\nfor Oban.\n",
type: :keyword_list,
keys: [
enabled: [
required: false,
type: :boolean,
default: false,
doc: "Whether to enable the Oban integration. When enabled, the Sentry SDK will\ncapture check-ins for Oban jobs. *Available since v10.2.0*.\n"
],
monitor_slug_generator: [
required: false,
type: {:tuple, [:atom, :atom]},
type_doc: "`{module(), atom()}`",
doc: "A `{module, function}` tuple that generates a monitor name based on the `Oban.Job` struct.\nThe function is called with the `Oban.Job` as its arguments and must return a string.\nThis can be used to customize monitor slugs. *Available since v10.8.0*.\n"
]
]
]
]
],
quantum: [
required: false,
type: :keyword_list,
doc: "Configuration for the [Quantum](https://github.com/quantum-elixir/quantum-core) integration.\n*Available since v10.2.0*.\n",
keys: [
cron: [
required: false,
doc: "Configuration options for configuring [*crons*](https://docs.sentry.io/product/crons/)\nfor Quantum.\n",
type: :keyword_list,
keys: [
enabled: [
required: false,
type: :boolean,
default: false,
doc: "Whether to enable the Quantum integration. When enabled, the Sentry SDK will\ncapture check-ins for Quantum jobs. *Available since v10.2.0*.\n"
]
]
]
]
],
telemetry: [
required: false,
type: :keyword_list,
doc: "Configuration for the [Telemetry](https://hexdocs.pm/telemetry) integration.\n*Available since v10.10.0*.\n",
keys: [
report_handler_failures: [
required: false,
type: :boolean,
default: false,
doc: "Whether to report failures (to Sentry) that happen in telemetry handlers. These failures\nresult in the handlers being detached, so capturing them in Sentry can be useful\nto detect and fix these issues as soon as possible.\n"
]
]
]
]
],
send_result: [
required: false,
type: {:in, [:none, :sync]},
default: :none,
type_doc: "`t:send_type/0`",
doc: "Controls what to return when reporting exceptions to Sentry.\n"
],
client: [
required: false,
type: :atom,
type_doc: "`t:module/0`",
default: Sentry.HackneyClient,
doc: "A module that implements the `Sentry.HTTPClient`\nbehaviour. Defaults to `Sentry.HackneyClient`, which uses\n[hackney](https://github.com/benoitc/hackney) as the HTTP client.\n"
],
send_max_attempts: [
required: false,
type: :pos_integer,
default: 4,
doc: "The maximum number of attempts to send an event to Sentry.\n"
],
hackney_opts: [
required: false,
type: :keyword_list,
default: [pool: :sentry_pool],
doc: "Options to be passed to `hackney`. Only\napplied if `:client` is set to `Sentry.HackneyClient`.\n"
],
hackney_pool_timeout: [
required: false,
type: :timeout,
default: 5000,
doc: "The maximum time to wait for a\nconnection to become available. Only applied if `:client` is set to\n`Sentry.HackneyClient`.\n"
],
hackney_pool_max_connections: [
required: false,
type: :pos_integer,
default: 50,
doc: "The maximum number of\nconnections to keep in the pool. Only applied if `:client` is set to\n`Sentry.HackneyClient`.\n"
],
enable_source_code_context: [
required: false,
type: :boolean,
default: false,
doc: "Whether to report source code context alongside events.\n"
],
root_source_code_paths: [
required: false,
type: {:list, :string},
default: [],
type_doc: "list of `t:Path.t/0`",
doc: "Aa list of paths to the root of\nyour application's source code. This is used to determine the relative\npath of files in stack traces. Usually, you'll want to set this to\n`[File.cwd!()]`. For umbrella apps, you should set this to all the application\npaths in your umbrella (such as `[Path.join(File.cwd!(), \"apps/app1\"), ...]`).\n**Required** if `:enabled_source_code_context` is `true`.\n"
],
source_code_path_pattern: [
required: false,
type: :string,
default: "**/*.ex",
doc: "A glob pattern used to\ndetermine which files to report source code context for. The glob \"starts\"\nfrom `:root_source_code_paths`.\n"
],
source_code_exclude_patterns: [
required: false,
type: {:list,
{:custom, Sentry.Config, :__validate_struct__,
[:source_code_exclude_patterns, Regex]}},
type_doc: "list of `t:Regex.t/0`",
doc: "A list of regular expressions used to determine which files to\nexclude from source code context.\n"
],
source_code_map_path: [
required: false,
type: :string,
type_doc: "`t:Path.t/0`",
doc: "The path to the source code map file. See\n[`mix sentry.package_source_code`](`Mix.Tasks.Sentry.PackageSourceCode`).\nDefaults to a private path inside Sentry's `priv` directory. *Available since v10.2.0*.\n"
],
context_lines: [
required: false,
type: :pos_integer,
default: 3,
doc: "The number of lines of source code\nbefore and after the line that caused the exception to report.\n"
],
in_app_otp_apps: [
required: false,
type: {:list, :atom},
default: [],
type_doc: "list of `t:atom/0`",
doc: "A list of OTP application names that will be used to populate additional modules for the\n`:in_app_module_allow_list` option. List your application (or the applications in your\numbrella project) for them to show as \"in-app\" in stacktraces in Sentry. We recommend using\nthis option over `:in_app_module_allow_list`, unless you need more control over the exact\nmodules to consider as \"in-app\".\n\n*Available since v10.9.0*.\n"
],
in_app_module_allow_list: [
required: false,
type: {:list, :atom},
default: [],
type_doc: "list of `t:module/0`",
doc: "A list of modules that is used\nto distinguish among stacktrace frames that belong to your app and ones that are\npart of libraries or core Elixir. This is used to better display the significant part\nof stacktraces. The logic is \"greedy\", so if your app's root module is `MyApp` and\nyou configure this option to `[MyApp]`, `MyApp` as well as any submodules\n(like `MyApp.Submodule`) would be considered part of your app.\n\nUsually, the `:in_app_otp_apps` option should be preferred as it's\nsimpler to work with.\n"
],
before_send: [
required: false,
type: {:or, [fun: 1, tuple: [:atom, :atom]]},
type_doc: "`t:before_send_event_callback/0`",
doc: "Allows performing operations on the event *before* it is sent as\nwell as filtering out the event altogether.\nIf the callback returns `nil` or `false`, the event is not reported. If it returns an\nupdated `Sentry.Event`, then the updated event is used instead. See the [*Event Callbacks*\nsection](#module-event-callbacks) below for more information.\n\n`:before_send` is available *since v10.0.0*. Before, it was called `:before_send_event`.\n"
],
before_send_event: [
required: false,
type: {:or, [fun: 1, tuple: [:atom, :atom]]},
type_doc: "`t:before_send_event_callback/0`",
deprecated: "Use :before_send instead.",
doc: "Exactly the same as `:before_send`, but has been **deprecated since v10.0.0**.\n"
],
after_send_event: [
required: false,
type: {:or, [fun: 2, tuple: [:atom, :atom]]},
type_doc: "`t:after_send_event_callback/0`",
doc: "Callback that is called *after*\nattempting to send an event. The result of the HTTP call as well as the event will\nbe passed as arguments. The return value of the callback is not returned. See the\n[*Event Callbacks* section](#module-event-callbacks) below for more information.\n"
]
]
} @mayel any chance you could share your stacktrace? |
Here's what I'm getting, using
|
:( I'm not sure what |
I wont have the time to look at this now. Suggestions:
|
Sentry compiles just fine here on OTP 28:
|
@wojtekmach with the latest version from hex as well? |
The latest version on Hex fails for me:
but my understanding is it does not contain the regex fix: #889. |
@wojtekmach could you try with latest stuff from master? |
Sorry I wasn’t clear, what I meant was Sentry master compiles just fine on OTP 28 for me. In other words, I don’t think this PR is necessary. |
@wojtekmach ah OK :) alright we're gonna push a release on Monday. @mayel can you try sentry-elixir from master to confirm that it works for you? |
Ah yes it compiles with latest master, thanks and sorry for the noise! (noting though that I had to add |
see https://elixirforum.com/t/elixir-v1-18-4-released/70965