Logo of AppSignal

Menu
Docs navigation

Tagging

Use the Appsignal.tag_request method to supply extra context on errors and performance issues. This can help to add information that is not already part of the request, session or environment parameters.

You can use Appsignal.tag_request wherever the current request is accessible, we recommend calling it before you application code runs in the request, such as in a before_action using Rails.

1
2
3
Appsignal.tag_request(
  :locale => I18n.locale
)

Warning: Do not use tagging to send personal data such as names or email addresses to AppSignal. If you want to identify a person, consider using a user ID, hash or pseudonymized identifier instead. You can use link templates to link them to your own system.

Tags

Using tags you can easily add more information to errors and performance issues tracked by AppSignal. There are a few limitations on tagging though.

  • The tag key must be a String or Symbol.
  • The tagged value must be a String, Symbol or Integer.
  • The length of the tag key and tagged value must be less than 100 characters.

Tags that do not meet these limitations are dropped without warning.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Good, I18n.locale/default_locale returns a symbol
Appsignal.tag_request(
  user: current_user.id,
  locale: I18n.locale,
  default_locale: I18n.default_locale
)

# Bad, hash type is not supported
Appsignal.tag_request(
  i18n: {
    locale: I18n.locale,
    default_locale: I18n.default_locale
  }
)

Link templates

Tags can also be used to create link templates. Read more about link templates in our link templates guide.

We'd like to set cookies, read why.