Open steveoni opened 2 years ago
First, there was an investigation of how ckanext-googleanalytics
works:
1) A track id is generated which is firstly added to the page header
2) Ckanext google analytics provides a custom function that is used to wrap all action functions and resource
API
3) Each API events are stored as a dictionary and sent to gooogleanalytics
4) There is functionality to store event data from google analytics in package_stats
and resource_stats
table for easy query to enable download stats display
This investigation is used to guide what to look for in Azure application insight
To use azure application insight we need to:
1) Setup application insights resource 2) Obtain the credential key which will be used with Azure SDK 3) Download Opencesus Python SDK 4) Experiment with how to use this SDK to intercept API and emit results to the azure application monitor and also receive updates from the application monitor.
This link https://docs.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python shows how to use the Python SDK, but the example only shows how to use logger
to emit log to azure to monitor the app.
Also after further investigation was able to obtain a version for the flask, which wrap the app with a flask middleware. This track all incoming request sent to our flask app https://docs.microsoft.com/en-us/azure/azure-monitor/app/opencensus-python-request
ISSUES:
1) The flask middleware can track incoming requests sent to the app, but no doc to sure how to create a custom tracking event as it is possible in google analytics. The custom event enables us to store events like a dictionary since we have different packages with resources, the custom event makes it possible to receive data for each of these packages.
2) No detailed documentation, and no lot of examples on how to use the package. Google analytics seems to be the most used and easy to get more information on.
But with more experiments and testing we can figure out how to use it for our main purpose.
Acceptance
Task