Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Feedback API supportability metric #2487

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions lib/new_relic/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ def record_llm_feedback_event(trace_id:,
message: nil,
metadata: NewRelic::EMPTY_HASH)

record_api_supportability_metric(:record_llm_feedback_event)
feedback_message_event = {
'trace_id': trace_id,
'rating': rating,
Expand Down
1 change: 1 addition & 0 deletions lib/new_relic/supportability_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ module SupportabilityHelper
:process_response_metadata,
:record_custom_event,
:record_metric,
:record_llm_feedback_event,
:recording_web_transaction?,
:require_test_helper,
:set_error_group_callback,
Expand Down
9 changes: 9 additions & 0 deletions test/new_relic/agent/llm/feedback_test.rb
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,15 @@ def test_record_llm_feedback_event_rescues_exception
end
end

def test_feedback_api_supportability_metric_recorded
in_transaction do |txn|
NewRelic::Agent.record_llm_feedback_event(trace_id: @trace_id, rating: 5)
NewRelic::Agent.agent.custom_event_aggregator.harvest!
end

assert_metrics_recorded('Supportability/API/record_llm_feedback_event')
end

def assert_logged(expected)
found = NewRelic::Agent.logger.messages.any? { |m| m[1][0].match?(expected) }

Expand Down
Loading