Uploaded image for project: 'Automation Hub'
  1. Automation Hub
  2. AAH-1558

Add collection download log to pulp ansible

    • Icon: Task Task
    • Resolution: Done
    • Icon: Major Major
    • None
    • None
    • Backend
    • None
    • False
    • Hide

      None

      Show
      None
    • False
    • ANSTRAT-137 - Insights reports for Partners (metric collection)

      Goal: Log information about users downloading collections from console.redhat.com for ansible analytics to consume and report to partners. The short term goal is to be able to tell our partner’s who is using their collections. The long term goal is to be able to provide a UI for viewing collection download metrics in private automation hub.

      Approach: create a new database model that stores information about every download that occurs

       

      Models

       

      CollectionDownloadLog

      Subclass pulpcore.plugin.models.BaseModel

      Fields:

      • collection_version: FK to collection version
      • user: FK to user or none of anonymous
      • ip: ip address that’s requesting the download
      • org_id: str
      • user_agent: user agent requesting the download
      • repository: fk to repository that user is downloading from

      Views

      Update the collection artifact download view to log the information specified in the model above every time a collection is downloaded.

      The org_id won't be available for on premise. It can be retrieved from the request object using an approach similar to this: https://github.com/ansible/galaxy_ng/blob/master/galaxy_ng/app/access_control/access_policy.py#L214. In cases where no red hat headers are available, this should be set to none in the database.

       

      Additional view for retrieving the information on: v3/plugin/ansible/collection-downloads into https://github.com/pulp/pulp_ansible/blob/main/pulp_ansible/app/galaxy/v3/views.py while alloving filtering on all fields and in addition on:

      • collection_version__namespace
      • collevtion_version_collection_name
      • repository__name

            dnewswan David Newswanger
            dnewswan David Newswanger
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: