module OpenTelemetry::Instrumentation::Utils
Utility functions
Constants
- CMD_MAX_LEN
- OPNAME_MAPPING
- STRING_PLACEHOLDER
Public Instance Methods
format_command(operation, args)
click to toggle source
# File lib/opentelemetry/instrumentation/dalli/utils.rb, line 47 def format_command(operation, args) placeholder = "#{operation} BLOB (OMITTED)" command = [operation, *args].join(' ').strip command = OpenTelemetry::Common::Utilities.utf8_encode(command, binary: true, placeholder: placeholder) OpenTelemetry::Common::Utilities.truncate(command, CMD_MAX_LEN) rescue StandardError => e OpenTelemetry.logger.debug("Error sanitizing Dalli operation: #{e}") placeholder end
opname(operation, multi)
click to toggle source
# File lib/opentelemetry/instrumentation/dalli/utils.rb, line 42 def opname(operation, multi) lookup_name = multi ? "multi_#{operation}" : operation.to_s OPNAME_MAPPING[lookup_name] || operation.to_s end