Sha256: d323feabd6fefb5b6d2a27f641c2b0300fad1650d46cbe6c1a428fe670cbe41d
Contents?: true
Size: 1.14 KB
Versions: 35
Compression:
Stored size: 1.14 KB
Contents
# Copyright (c) 2013 AppNeta, Inc. # All rights reserved. module Oboe ## # Methods to act on, manipulate or investigate an X-Trace # value module XTrace class << self ## # Oboe::XTrace.valid? # # Perform basic validation on a potential X-Trace ID # def valid?(xtrace) # Shouldn't be nil return false unless xtrace # The X-Trace ID shouldn't be an initialized empty ID return false if (xtrace =~ /^1b0000000/i) == 0 # Valid X-Trace IDs have a length of 58 bytes and start with '1b' return false unless xtrace.length == 58 && (xtrace =~ /^1b/i) == 0 true rescue StandardError => e Oboe.logger.debug e.message Oboe.logger.debug e.backtrace false end ## # Oboe::XTrace.task_id # # Extract and return the task_id portion of an X-Trace ID # def task_id(xtrace) return nil unless Oboe::XTrace.valid?(xtrace) xtrace[2..41] rescue StandardError => e Oboe.logger.debug e.message Oboe.logger.debug e.backtrace return nil end end end end
Version data entries
35 entries across 35 versions & 1 rubygems