monocle icon indicating copy to clipboard operation
monocle copied to clipboard

[spec] Enhance author details in Monocle

Open morucci opened this issue 4 years ago • 4 comments
trafficstars

Provide a solution to enhance a Monocle UID

Monocle indexes changes and events by adding an identity information following different schemes based on the source of the Change (Gerrit/Github).

Monocle allows to group multiple UID under a Monocle UID.

The Monocle UID is auto-computed or created based on the information given in the configuration file: https://github.com/change-metrics/monocle#identity-management

We want to give Monocle more information about identities to perform for instance:

  • Display the Full Name of the identity in the UI
  • Display the user gravatar
  • Display user group membership and Companies
  • Compute groups / companies metrics

New fields in index to store identities details

{
    "_type": Identity
    "id": str: <Monocle UID>
    "aliases": str
    "username": str,
    "fullname": str,
    "avatar_url": str,
    "gravatar_id": str,
    "email": str,
    "groups": [str]
    "company": str
}

Source

The configuration file is extended to allows such description though the ident field.

Application

The configuration is pushed into EL via a Monocle CLI command.

New EL queries

New functions to query the EL index to gather Identities data are needed:

  • Get Ident details from the Monocle UID
  • Get list of groups
  • Get idents part of a given group/company
  • From a list of idents get group/company buckets

UI

  • Filter by group
  • Pie charts to show group distribution
  • Enhance author display by showing the Full Name
  • ...

Other ideas for later

This identities data could be gathered from external sources. For instance we can think of bot that crawl GitHub to fetch Identity data for known GitHub username (from the Monocle Change DB).

Write crawlers (for Gerrit and Github) able to fetch users data from Code review system:

On gerrit: For: Rabotyagov/28619

https://review.opendev.org/accounts/28619
{"_account_id":28619,"name":"Dmitriy *****","email":"******@ya.ru","username":"******"}

For: rdo-trunk/139

https://review.rdoproject.org/r/accounts/139
{
  "_account_id": 139,
  "name": "rdo-trunk",
  "email": "...",
  "username": "rdo-trunk",
  "avatars": [
    {
      "url": "https://www.gravatar.com/avatar/b726b19f8e7c2e23e403e4b5d3ab4508.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d26",
      "height": 26
    },
    {
      "url": "https://www.gravatar.com/avatar/b726b19f8e7c2e23e403e4b5d3ab4508.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d32",
      "height": 32
    },
    {
      "url": "https://www.gravatar.com/avatar/b726b19f8e7c2e23e403e4b5d3ab4508.jpg?d\u003didenticon\u0026r\u003dpg\u0026s\u003d100",
      "height": 100
    }
  ]
}

On github.com For: BitcoinTsunami

https://api.github.com/users/BitcoinTsunami
{
  "login": "BitcoinTsunami",
  "id": 75384375,
  "node_id": "MDQ6VXNlcjc1Mzg0Mzc1",
  "avatar_url": "https://avatars.githubusercontent.com/u/75384375?v=4",
  "gravatar_id": "",
  "url": "https://api.github.com/users/BitcoinTsunami",
  "html_url": "https://github.com/BitcoinTsunami",
  "followers_url": "https://api.github.com/users/BitcoinTsunami/followers",
  "following_url": "https://api.github.com/users/BitcoinTsunami/following{/other_user}",
  "gists_url": "https://api.github.com/users/BitcoinTsunami/gists{/gist_id}",
  "starred_url": "https://api.github.com/users/BitcoinTsunami/starred{/owner}{/repo}",
  "subscriptions_url": "https://api.github.com/users/BitcoinTsunami/subscriptions",
  "organizations_url": "https://api.github.com/users/BitcoinTsunami/orgs",
  "repos_url": "https://api.github.com/users/BitcoinTsunami/repos",
  "events_url": "https://api.github.com/users/BitcoinTsunami/events{/privacy}",
  "received_events_url": "https://api.github.com/users/BitcoinTsunami/received_events",
  "type": "User",
  "site_admin": false,
  "name": "Bitcoin Tsunami",
  "company": null,
  "blog": "",
  "location": null,
  "email": null,
  "hireable": null,
  "bio": null,
  "twitter_username": null,
  "public_repos": 2,
  "public_gists": 0,
  "followers": 0,
  "following": 0,
  "created_at": "2020-12-02T16:39:13Z",
  "updated_at": "2021-02-12T22:39:23Z"
}

morucci avatar Feb 17 '21 15:02 morucci

A group might need to be a list of str

morucci avatar Apr 09 '21 09:04 morucci

Could we use a different index instead of adding a new document _type?

TristanCacqueray avatar Apr 27 '21 16:04 TristanCacqueray

Yes sure we can use another index.

morucci avatar Apr 27 '21 17:04 morucci

Note that the identity configuration now enables setting group, this was implemented with https://github.com/change-metrics/monocle/pull/438

TristanCacqueray avatar Jul 05 '21 12:07 TristanCacqueray