Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion lib/influxdb/rails/configuration.rb
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,11 @@ class Configuration
set_defaults(
measurement_name: "rails".freeze,
ignored_hooks: [].freeze,
tags_middleware: ->(tags) { tags },
tags_middleware: lambda { |tags|
tags.reject do |_key, value|
value.nil? || (value.is_a?(String) && value.squish.empty?)
end
},
rails_app_name: nil,
ignored_environments: %w[test cucumber selenium].freeze,
environment: ::Rails.env,
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/tags.rb → spec/unit/influx_db/rails/tags_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

it "removes empty strings" do
subject = described_class.new(config: config, tags: { hans: "", franz: " " })
expect(subject.to_h).not_to a_hash_including(hans: "", franz: " ")
expect(subject.to_h).not_to a_hash_including(:hans, :franz)
end

it "returns symbols" do
Expand All @@ -36,7 +36,7 @@

it "removes nil" do
subject = described_class.new(config: config, tags: { hans: nil })
expect(subject.to_h).not_to a_hash_including(hans: nil)
expect(subject.to_h).not_to a_hash_including(:hans)
end

it "leaves arrays alone" do
Expand Down