ckan / ideas

[DEPRECATED] Use the main CKAN repo Discussions instead:
https://github.com/ckan/ckan/discussions
40 stars 2 forks source link

Track API usage #72

Open rufuspollock opened 10 years ago

rufuspollock commented 10 years ago

We track analytics on the front end using Google Analytics or similar (e.g. piwik)

However, we don't track API usage in any systematic way. This would be useful to provide reports to users and also in order to manage API use.

Proposal

One of the simplest options would be to plug into google analytics system but from the server side using "universal analytics" - there's a python universal library here.

# as python named-arguments
tracker.send('pageview', path = "/test", title = "Test page") 

# as property dictionary 
tracker.send('pageview', {
  'path': "/test",
  'title': "Test page"
})

We could also use this to track other activity e.g. certain kinds of events:

from UniversalAnalytics import Tracker

tracker = Tracker.create('UA-XXXXX-Y', client_id = CUSTOMER_UNIQUE_ID)
tracker.send('event', 'Subscription', 'billing')

Note: afaict alternatives to GA like piwik do not support the "Measurement Protocol"

marks commented 10 years ago

+1; while there is some vendor lock-in with Google Analytics, this is something I have been thinking would be useful to CKAN users.

Another option would be to have hooks for a full-fledged API (quota) management platform of which there are several open source and COTS ones available. One resource: http://management.apievangelist.com/

maxious commented 10 years ago

I did a hacky patch to the googleanalytics extension to track API usage https://github.com/ckan/ckanext-googleanalytics/pull/6

adamamyl commented 10 years ago

+1

gjlawran commented 10 years ago

Also interested in API usage tracking. Not sure if a web analytics (GA/piwick) or daily server log processing would be the most efficient.

adamamyl commented 10 years ago

I think for most people, real-time is more useful than a daily log, particularly for things like rate-limiting / quota-ing.

gjlawran commented 10 years ago

@adamamyl agreed quota management / rate limiting is a whole new dimension / problem - I would just like to report to my data providers the use that their data resources see - regardless of the access mechanism.