Class: SentryMessageFormat
- Inherits:
-
Object
- Object
- SentryMessageFormat
- Defined in:
- lib/fluent/plugin/out_sentry.rb
Instance Attribute Summary collapse
-
#contexts ⇒ Object
Returns the value of attribute contexts.
-
#environment ⇒ Object
Returns the value of attribute environment.
-
#error_message ⇒ Object
Returns the value of attribute error_message.
-
#error_type ⇒ Object
Returns the value of attribute error_type.
-
#event_id ⇒ Object
Returns the value of attribute event_id.
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#release ⇒ Object
Returns the value of attribute release.
-
#request ⇒ Object
Returns the value of attribute request.
-
#server_name ⇒ Object
Returns the value of attribute server_name.
-
#tags ⇒ Object
Returns the value of attribute tags.
-
#timestamp ⇒ Object
Returns the value of attribute timestamp.
-
#transaction ⇒ Object
Returns the value of attribute transaction.
-
#user ⇒ Object
Returns the value of attribute user.
Instance Method Summary collapse
- #create_context(otel_trace_id) ⇒ Object
-
#initialize(timestamp, event_id, component_name, environment, release, tags, request, exception, platform, transaction, otel_trace_id, user) ⇒ SentryMessageFormat
constructor
A new instance of SentryMessageFormat.
- #to_json(*_args) ⇒ Object
Constructor Details
#initialize(timestamp, event_id, component_name, environment, release, tags, request, exception, platform, transaction, otel_trace_id, user) ⇒ SentryMessageFormat
Returns a new instance of SentryMessageFormat.
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/fluent/plugin/out_sentry.rb', line 61 def initialize( , event_id, component_name, environment, release, , request, exception, platform, transaction, otel_trace_id, user ) @event_id = event_id @timestamp = @server_name = component_name @environment = environment @release = release @tags = @request = request @platform = platform @transaction = transaction unless otel_trace_id.include? 'ukw' self.contexts = create_context(otel_trace_id) end @user = if user.nil? {} else @user end self.exception = SentryException.new(exception) end |
Instance Attribute Details
#contexts ⇒ Object
Returns the value of attribute contexts.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def contexts @contexts end |
#environment ⇒ Object
Returns the value of attribute environment.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def environment @environment end |
#error_message ⇒ Object
Returns the value of attribute error_message.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def @error_message end |
#error_type ⇒ Object
Returns the value of attribute error_type.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def error_type @error_type end |
#event_id ⇒ Object
Returns the value of attribute event_id.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def event_id @event_id end |
#exception ⇒ Object
Returns the value of attribute exception.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def exception @exception end |
#platform ⇒ Object
Returns the value of attribute platform.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def platform @platform end |
#release ⇒ Object
Returns the value of attribute release.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def release @release end |
#request ⇒ Object
Returns the value of attribute request.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def request @request end |
#server_name ⇒ Object
Returns the value of attribute server_name.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def server_name @server_name end |
#tags ⇒ Object
Returns the value of attribute tags.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def @tags end |
#timestamp ⇒ Object
Returns the value of attribute timestamp.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def @timestamp end |
#transaction ⇒ Object
Returns the value of attribute transaction.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def transaction @transaction end |
#user ⇒ Object
Returns the value of attribute user.
57 58 59 |
# File 'lib/fluent/plugin/out_sentry.rb', line 57 def user @user end |
Instance Method Details
#create_context(otel_trace_id) ⇒ Object
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/fluent/plugin/out_sentry.rb', line 98 def create_context(otel_trace_id) contexts = {} contexts['trace'] = {} contexts['trace']['op'] = 'http.server' contexts['trace']['status'] = 'unknown' contexts['trace']['type'] = 'trace' contexts['trace']['trace_id'] = otel_trace_id.split('-')[0] contexts['trace']['span_id'] = otel_trace_id.split('-')[1] if self..nil? self. = {} end self.['trace_id'] = contexts['trace']['trace_id'] contexts end |
#to_json(*_args) ⇒ Object
116 117 118 119 120 121 122 123 |
# File 'lib/fluent/plugin/out_sentry.rb', line 116 def to_json(*_args) hash = {} instance_variables.each do |var| hash[var.to_s.delete '@'] = instance_variable_get var end hash.to_json end |