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

WIP statsd metrics eps appointments #20335

Draft
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

cferris32
Copy link
Contributor

Summary

  • Adds statsd metric logging to the eps appointments service, tracking completed service calls and error responses.

Related issue(s)

  • GH#96415

Testing done

@va-vfs-bot va-vfs-bot temporarily deployed to 96415_statsd_eps_appointments/main/main January 16, 2025 21:52 Inactive
@va-vfs-bot va-vfs-bot temporarily deployed to 96415_statsd_eps_appointments/main/main January 16, 2025 22:19 Inactive
Copy link
Contributor

@lee-delarm6 lee-delarm6 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

One request, one question open :)

unless response.status == 200
# log failures
StatsD.increment(STATSD_KEY, tags: ["failures:#{response.body}"])
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since the same code is used, could this be extracted to a method like

def track_metric(key, tag)
  StatsDMetric.new(key: key).save
  StatsD.increment(key, tags: [tag])
end

and then just do:

track_metric(STATSD_KEY, 'get_appointments call completed')

(or whatever the tag is)

StatsD.increment(STATSD_KEY, tags: ['create_draft_appointment call completed'])
unless response.status == 200
# log failures
StatsD.increment(STATSD_KEY, tags: ["failures:#{response.body}"])
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure we can log the response body if it had private data in it, but it might be totally fine. It's obviously very useful. Question for @randomsync or @kanchanasuriya

@va-vfs-bot va-vfs-bot temporarily deployed to 96415_statsd_eps_appointments/main/main January 17, 2025 16:46 Inactive
@@ -10,6 +12,13 @@ class AppointmentService < BaseService
def get_appointments
response = perform(:get, "/#{config.base_path}/appointments?patientId=#{patient_id}",
{}, headers)

track_metric(STATSD_KEY, 'get_appointments call completed')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please see if we can make use of existing vaos_logging middleware?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants