Add Custom Data

This feature requires AppSignal for Ruby version 4.0.0 or higher.
This feature requires AppSignal for Elixir version 1.0.0 or higher.
This feature requires AppSignal for Node.js version 3.0.0 or higher.
This feature requires AppSignal for Python version 0.3.0 or higher.

You can use custom sample data to set more dynamic values than other types of custom data allow.

Do not send Personal Identifiable Information (PII) to AppSignal. Filter PII (e.g., names, emails) and use an ID, hash, or pseudonymized identifier instead.

Use Link Templates to link them back in your app.

See the table below for a list of accepted root values per language. Each nested object can contain values that result in valid JSON (strings, integers, floats, booleans, nulls, etc.).

LanguageAccepted root values
RubyArrays, Hashes
JavaScriptArrays, Objects
ElixirLists, Maps
PythonLists, Maps

It is not possible to filter or search on the data set as custom data. It only provides an additional area in the interface to list more metadata.

When using custom data for nested objects, you can view the object on the Incident Sample page for both Exception and Performance samples formatted as JSON, like in the example below:

Ruby
# Call `add_custom_data` multiple times to add more custom data # Hash example Appsignal.add_custom_data( :stroopwaffle => { :caramel => true }, :market => { :type => "outdoors" } ) Appsignal.add_custom_data(:market => { :state => :closed }) Appsignal.add_custom_data(:market => { :state => :open }) # Custom data: # { # :stroopwaffle => { :caramel => true }, # :market => { :state => :open } # } # Array example Appsignal.add_custom_data(["value 1"]) Appsignal.add_custom_data(["value 2"]) # Custom data: ["value 1", "value 2"] # Mixed data type example # The Hash and Array data type cannot be mixed at the root level Appsignal.add_custom_data(:market => :open) Appsignal.add_custom_data(["value 1"]) # Custom data: ["value 1"]
Elixir
# Map Appsignal.Span.set_sample_data( Appsignal.Tracer.root_span, "custom_data", %{ stroopwaffle: %{ caramel: true, origin: "market" } } ) # List Appsignal.Span.set_sample_data( Appsignal.Tracer.root_span, "custom_data", [ "value 1", "value 2" ] )
Node.js
import { setCustomData } from "@appsignal/nodejs"; // Object setCustomData({ stroopwaffle: { caramel: true, origin: "market", }, }); // Array setCustomData(["value 1", "value 2"]);
Python
from appsignal import set_custom_data # Map set_custom_data({ "stroopwaffle": { "caramel": true, "origin": "market" } }) # Array set_custom_data(["value 1", "value 2"])

If the application sets custom data multiple times, the Ruby gem will merge values at the root level. For other integrations, only the last set value is stored.

custom_data