Class: NitroIntelligence::Reporter
- Inherits:
-
Object
- Object
- NitroIntelligence::Reporter
- Defined in:
- lib/nitro_intelligence/reporter.rb
Instance Method Summary collapse
- #create_dataset_item(attributes) ⇒ Object
-
#initialize(observability_project_slug:) ⇒ Reporter
constructor
A new instance of Reporter.
- #score(trace_id:, name:, value:, id: "#{trace_id}-#{name}") ⇒ Object
Constructor Details
#initialize(observability_project_slug:) ⇒ Reporter
Returns a new instance of Reporter.
6 7 8 9 10 |
# File 'lib/nitro_intelligence/reporter.rb', line 6 def initialize(observability_project_slug:) @observability_project_slug = observability_project_slug @project_client = fetch_project_client @host = NitroIntelligence.config.observability_base_url end |
Instance Method Details
#create_dataset_item(attributes) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/nitro_intelligence/reporter.rb', line 12 def create_dataset_item(attributes) HTTParty.post("#{@host}/api/public/dataset-items", body: attributes.to_json, headers: { "Content-Type" => "application/json", "Authorization" => "Basic #{@project_client.project.auth_token}", }) end |
#score(trace_id:, name:, value:, id: "#{trace_id}-#{name}") ⇒ Object
21 22 23 24 25 26 27 28 29 |
# File 'lib/nitro_intelligence/reporter.rb', line 21 def score(trace_id:, name:, value:, id: "#{trace_id}-#{name}") @project_client.observability_client.create_score( id:, trace_id:, name:, value:, environment: NitroIntelligence.environment ) end |