Gathering API Usage Analytics for Medplum
# support
t
Hi @rahul1 We use the Medplum server for my healthcare implementation, where various healthcare providers subscribe to my SaaS platform for different services. Our subscription model is based on active users, and I want to better understand the platform's performance through detailed analytics. Specifically, I need to gather data on the usage of API calls by clients, where each client has their own project, and each project can include multiple organizations. I have the following questions: API Usage by Project: How can I count the API usage based on unique projects? Which APIs are being used the most? I am interested in obtaining statistical information about API usage at the project level. API Usage by Organization: How can I count the API usage separately for each organization under a project? How many API requests are triggered by each organization, and what types of requests are they? Which API calls are the most frequent, and what is the response time for these API calls? Can you please suggest the best way to gather this data? Do we have anything in Medplum for this or could you please recommend any tools that could help in obtaining such analytics? The Medplum is hosted on AWS. Considering there could be numerous clients and organizations, performance is a crucial aspect. Could you guide us on an implementation approach that won’t negatively impact the performance of the APIs and the product?
z
you might want to explore using a time series database or other observability solution like Prometheus. It would be possible to build a [Prometheus Exporter](https://prometheus.io/docs/instrumenting/exporters/) for Medplum that tracks the applications api usage over time.
that might be a fun project actually
but that's not OSS
you could also capture a lot of this information at the network layer instead of at the application layer. Here is a super advanced dashboard for NGINX traffic using Loki, which is "like Prometheus but for logs" https://play.grafana.org/d/T512JVH7z/loki-nginx-service-mesh-json-version?var-datasource=ac4000ca-1959-45f5-aa45-2bd0898f7026&var-label_name=filename&var-label_value=/var/log/nginx/json_access.log&var-job=$__all&var-instance=$__all
t
Thank you @zuchka_ I will look at this.
Additionally @rahul1 , I noticed that your pricing page includes a package for 'FHIR Resources Stored'. Could you please explain how this is calculated? We could adapt this approach for our use case with some modifications to the code. Would you be able to guide us on how to do this? or point us to the relevant code base so that we can take a reference of the same?
r
Thanks for suggestions @sir_marbles Hi @tusharnisal , we generally use our super admin views to check on resource usage per project
181 Views