Class: NewRelic::Agent::DistributedTracing::TraceContext::HeaderData

Inherits:
Object
  • Object
show all
Defined in:
lib/new_relic/agent/distributed_tracing/trace_context.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(trace_parent, trace_state_payload, trace_state_entries, trace_state_size, trace_state_vendors) ⇒ HeaderData

Returns a new instance of HeaderData.



192
193
194
195
196
197
198
199
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 192

def initialize(trace_parent, trace_state_payload, trace_state_entries, trace_state_size, trace_state_vendors)
  @trace_parent = trace_parent
  @trace_state = nil
  @trace_state_entries = trace_state_entries
  @trace_state_payload = trace_state_payload
  @trace_state_size = trace_state_size
  @trace_state_vendors = trace_state_vendors
end

Instance Attribute Details

#trace_parentObject



201
202
203
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 201

def trace_parent
  @trace_parent
end

#trace_state_payloadObject



201
202
203
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 201

def trace_state_payload
  @trace_state_payload
end

#trace_state_vendorsObject



201
202
203
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 201

def trace_state_vendors
  @trace_state_vendors
end

Class Method Details

.create(trace_parent: nil, trace_state_payload: nil, trace_state_entries: nil, trace_state_size: 0, trace_state_vendors: nil) ⇒ Object



179
180
181
182
183
184
185
186
187
188
189
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 179

def create(trace_parent: nil,
  trace_state_payload: nil,
  trace_state_entries: nil,
  trace_state_size: 0,
  trace_state_vendors: nil)
  new(trace_parent, \
    trace_state_payload, \
    trace_state_entries, \
    trace_state_size, \
    trace_state_vendors)
end

Instance Method Details

#parent_idObject



214
215
216
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 214

def parent_id
  @trace_parent[PARENT_ID_KEY]
end

#trace_idObject



210
211
212
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 210

def trace_id
  @trace_parent[TRACE_ID_KEY]
end

#trace_state(trace_state_entry) ⇒ Object



203
204
205
206
207
208
# File 'lib/new_relic/agent/distributed_tracing/trace_context.rb', line 203

def trace_state(trace_state_entry)
  @trace_state ||= join_trace_state(trace_state_entry.size)
  @trace_state_entries = nil

  trace_state_entry = "#{trace_state_entry}#{@trace_state}"
end