Skip to content

Commit

Permalink
Allow tags to contain boolean values
Browse files Browse the repository at this point in the history
Our pipeline support boolean values in tags. Let's accept those values.
  • Loading branch information
tombruijn committed Jul 9, 2024
1 parent 41410a2 commit 1b8e86c
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 3 deletions.
11 changes: 11 additions & 0 deletions .changesets/allow-booleans-in-tags.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
bump: patch
type: change
---

Allow tags to have boolean (true/false) values.

```ruby
Appsignal.set_tags("my_tag_is_amazing" => true)
Appsignal.set_tags("my_tag_is_false" => false)
```
2 changes: 1 addition & 1 deletion lib/appsignal/transaction.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class Transaction
# @api private
ALLOWED_TAG_KEY_TYPES = [Symbol, String].freeze
# @api private
ALLOWED_TAG_VALUE_TYPES = [Symbol, String, Integer].freeze
ALLOWED_TAG_VALUE_TYPES = [Symbol, String, Integer, TrueClass, FalseClass].freeze
# @api private
BREADCRUMB_LIMIT = 20
# @api private
Expand Down
8 changes: 6 additions & 2 deletions spec/lib/appsignal/transaction_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -501,7 +501,9 @@ def create_transaction(id = transaction_id)
:array_value => %w[invalid array],
:object => Object.new,
:too_long_value => long_string,
long_string => "too_long_key"
long_string => "too_long_key",
:true_tag => true,
:false_tag => false
)
transaction._sample

Expand All @@ -511,7 +513,9 @@ def create_transaction(id = transaction_id)
"both_symbols" => "valid_value",
"integer_value" => 1,
"too_long_value" => "#{"a" * 10_000}...",
long_string => "too_long_key"
long_string => "too_long_key",
"true_tag" => true,
"false_tag" => false
)
end

Expand Down

0 comments on commit 1b8e86c

Please sign in to comment.