Skip to content

Incorrect configuration for Elixir Sentry LoggerHandler #10646

@ijdickinson

Description

@ijdickinson

Core or SDK?

Platform/SDK

Which part? Which one?

Elixir

Description

On this page you suggest the following configuration for the log handler:

config :my_app, :logger, [
  {:handler, :my_sentry_handler, Sentry.LoggerHandler, %{
    config: %{
      metadata: [:file, :line],
      rate_limiting: [max_events: 10, duration: _1_second = 1_000],
      capture_log_messages: true
    }
  }}
]

duration is incorrect, and causes the initialisation to exit:

{"message":{"logger":"callback_crashed","process":"logger","reason":["error",{"message":"expected :rate_limiting option to match at least one given type, but didn't match any. Here are the reasons why it didn't match each of the allowed types:\n\n  * unknown options [:duration], valid options are: [:max_events, :interval] (in options [:rate_limiting])\n  * invalid value for :rate_limiting option: expected one of [nil], got: [max_events: 10, duration: 1000]","value":{"duration":1000,"max_events":10},"key":"rate_limiting","__exception__":true,"keys_path":[]}

Suggested Solution

Replace the duration key with interval.

config :my_app, :logger, [
  {:handler, :my_sentry_handler, Sentry.LoggerHandler, %{
    config: %{
      metadata: [:file, :line],
      rate_limiting: [max_events: 10, interval: _1_second = 1_000],
      capture_log_messages: true
    }
  }}
]

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions