Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at bugzilla.redhat.com.

Bug 1647454

Summary: RFE to allow for better stats gathering
Product: [Fedora] Fedora Reporter: Jim Perrin <jperrin>
Component: libdnfAssignee: Michal Domonkos <mdomonko>
Status: CLOSED CURRENTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: high    
Version: rawhideCC: dmach, jberan, jmracek, jrohel, mblaha, mdomonko, mhatina, packaging-team-maint, pkratoch, rpm-software-management, vmukhame
Target Milestone: ---Keywords: Triaged
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: libdnf-0.35.3-1.fc31 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
: 1676891 (view as bug list) Environment:
Last Closed: 2019-08-15 07:58:16 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1676891, 1737516    

Description Jim Perrin 2018-11-07 13:59:14 UTC
Description of problem:
Currently, very little in dnf allows for statistics to be gathered about which packages or modules as user has chosen to install. I'd like to request that an 'install' action in dnf pass this information to the server as part of the request for repository information. In this fashion, a url could be constructed that would gather package information.

A hypothetical example repository url for fedora could be:

metalink=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch&pkg=$install


In this example, $install would be an array containing the names of packages the user requested to install. On update/non-install actions it would be empty and simply ignored in the server logs. 

This would provide fedora a way to show packagers a rough idea of how many times their package was being installed. 


Below is a mailing list request from the community for this type of information:

https://lists.fedoraproject.org/archives/list/infrastructure@lists.fedoraproject.org/thread/BLUC224OHMHYAWPC3MWJLFUIJZR2COZT/

Comment 1 Daniel Mach 2019-02-13 14:10:49 UTC
Fedora Change: https://fedoraproject.org/wiki/Changes/DNF_Better_Counting


The change consists of 2 parts:
- User-Agent change
- countme feature


User-Agent
----------

Schemas:
libdnf/$libdnf_version ($NAME $VERSION_ID; Linux.$basearch)
libdnf/$libdnf_version ($NAME $VERSION_ID; $VARIANT_ID; Linux.$basearch)

Examples:
libdnf/0.26.0 (Fedora 29; Linux.x86_64)
libdnf/0.26.0 (Fedora 29; server; Linux.x86_64)
libdnf/0.26.0 (Red Hat Enterprise Linux 7.6; workstation; Linux.x86_64)


Countme
-------
Add a new 'countme' option to repo configs, for example:
[fedora]
countme = 1

Create a new dnf sub-command to trigger the countme feature:
$ dnf countme
Iterate through all repos:
if countme == 1:
   GET($url?countme=1)
   where $url is first available from [metalink, mirrorlist, baseurl]
   # consider using HEAD instead of GET

Create a systemd timer triggering the `dnf countme` command periodically

Comment 2 Michal Domonkos 2019-02-15 19:41:36 UTC
Note to (mostly) self on capturing the User-Agent field:

1) Create a local repo (id=myrepo) somewhere on the file system and host it with:
  $ python -m SimpleHTTPServer &
2) Create /etc/yum.repos.d/myrepo.repo
3) In one terminal, run:
  # tcpflow -p -c -i lo port 8000 | grep -i user-agent
4) In another terminal, run:
  # dnf --refresh --disablerepo=\* --enablerepo=myrepo makecache
5) Observe the User-Agent value in the first terminal

Comment 3 Michal Domonkos 2019-08-05 14:47:16 UTC
Upstream PR: https://github.com/rpm-software-management/libdnf/pull/768

Comment 4 Michal Domonkos 2019-08-05 14:51:41 UTC
I've also requests the addition "countme=1" to the fedora-repos package:
https://bugzilla.redhat.com/show_bug.cgi?id=1737516

Comment 5 Michal Domonkos 2019-08-05 15:00:08 UTC
*requested