Module: Highlight

Defined in:
lib/highlight.rb,
lib/highlight/version.rb

Defined Under Namespace

Modules: Helpers, Integrations, Tracing Classes: H, HighlightHeaders, Logger, Railtie

Constant Summary collapse

VERSION =
'0.5.4'.freeze

Class Method Summary collapse

Class Method Details

.exception(error, attrs = {}) ⇒ Object



40
41
42
43
44
# File 'lib/highlight.rb', line 40

def self.exception(error, attrs = {})
  return unless H.initialized?

  H.instance&.record_exception(error, attrs)
end

.flushObject



58
59
60
61
62
# File 'lib/highlight.rb', line 58

def self.flush
  return unless H.initialized?

  H.instance.flush
end

.init(project_id, environment: '', otlp_endpoint: H::OTLP_HTTP, &block) ⇒ Object



22
23
24
# File 'lib/highlight.rb', line 22

def self.init(project_id, environment: '', otlp_endpoint: H::OTLP_HTTP, &block)
  H.new(project_id, environment: environment.to_s, otlp_endpoint: otlp_endpoint, &block)
end

.log(level, message, attrs = {}) ⇒ Object



34
35
36
37
38
# File 'lib/highlight.rb', line 34

def self.log(level, message, attrs = {})
  return unless H.initialized?

  H.instance&.record_log(nil, nil, level, message, attrs)
end

.shutdownObject



64
65
66
67
68
# File 'lib/highlight.rb', line 64

def self.shutdown
  return unless H.initialized?

  H.instance.shutdown
end

.start_span(name, attrs = {}, &block) ⇒ Object



26
27
28
29
30
31
32
# File 'lib/highlight.rb', line 26

def self.start_span(name, attrs = {}, &block)
  if H.initialized?
    H.instance.start_span(name, attrs, &block)
  elsif block_given?
    yield(OpenTelemetry::Trace::Span::INVALID)
  end
end

.traceparent_metaObject



46
47
48
49
50
# File 'lib/highlight.rb', line 46

def self.traceparent_meta
  return unless H.initialized?

  Helpers.traceparent_meta
end

.traceparent_meta_tagObject



52
53
54
55
56
# File 'lib/highlight.rb', line 52

def self.traceparent_meta_tag
  return unless H.initialized?

  Helpers.traceparent_meta_tag
end