Giter Site home page Giter Site logo

sharetary's Introduction

Sharetary

Sharetary is a cross-origin events viewer. The name is neoterized from two terms "share" and "secretary".

This provides ability to watch various "events" stored into a Groonga server, in real time or analytically by two different views:

  • Timeline view - You can watch events in real time, like Twitter or something. Newly added events will appear on the top of the view automatically.
  • Archive view - You can watch events statically, with their relations. Related events are visible as a thread.

How to start the server?

$ sudo npm install -g sharetary
$ sharetary-server

You must install Node.js and npm before installation. For example, on Ubuntu 14.04LTS:

$ sudo apt-get install nodejs nodejs-legacy npm

See sharetary-server --help for more details.

How to crawl events?

Sharetary doesn't provide ability to crawl events from sources. You need to crawl and load events by something other way.

In other words, you can use any data source for Sharetary, if you load them to the database in a common format described at this section.

Sharetary uses Groonga or Droonga as its backend. You simply have to define some tables with required columns (and load data to them):

Events (TABLE_HASH_KEY or TABLE_PAT_KEY)

  • _key (any type): Something to identify each event uniquely. For example, URI string, hash string, or others.
  • type (Text or ShortText): Indicates the type of each event. For example, an event indicating a "push" activity on the GitHub will have the string push as its type.
  • class (Text or ShortText): Indicates the magnitude of each event. Three possible values: important, major, normal, and minor. important and major events will be highlighted in the view.
  • tags (vector of Tags): Indicates tags associated to events. For example, events from GitHub activities will belong to any repository, so their repository name is suitable as a tag.
  • title (Text or ShortText): Short description of each event. For example, an event indicating a "push" activity on the GitHub will have its title like: "Pushed N commits to the repository".
  • description (Text or ShortText): The main description of each event. For example, an event indicating a "commit" activity on the GitHub will have its commit message as its description.
  • extra_description (Text or ShortText): The extra description of each event. It won't be rendered in the view, but will be shown in the tooltip of events. For example, an event indicating a "commit" activity on the GitHub will have its "diff" as its extra_description.
  • uri (Text or ShortText): The related URI of each event.
  • source_icon (Text or ShortText): URI of the icon for the source of the event. For example, events from Github activities will have favicon's URI as its soruce_icon.
  • reply_uri (Text or ShortText): The URI of an UI to post any reply for each event. For example, an event indicating a "commit" activity on the GitHub will have link to the comment form of the commit as its reply_uri. If your crawler fetches posted comments from the UI also, then you'll see them as events related to the parent event.
  • actor (Actors): Indicates the actor's name of each event. For example, an events from GitHub activity will have the account id as its actor.
  • timestamp (`Time'): The time when the event was triggered at. Events are sorted by this field in the archive view.
  • created_at (`Time'): The time when the record of the event was loaded to the database. Events are sorted by this field in the timeline view.
  • parent (Text or ShortText): The _key of another event. For example, an event indicating a "issue comment" activity on the GitHub will have the _key of the "issue opened" event as its parent.

Tags (TABLE_HASH_KEY or TABLE_PAT_KEY)

  • icon (Text or ShortText): URI of the icon for the tag.

Actors (TABLE_HASH_KEY or TABLE_PAT_KEY)

  • uri (Text or ShortText): The related URI of the actor.
  • icon (Text or ShortText): URI of the icon for the actor.
  • class (Text or ShortText): Indicates the magnitude of the actor. Two possible values: major, normal, and minor. Events triggered by minor actors will be shown with small text and lighter color in the view. For example, if you have events triggered by both students and teachers and you hope to see students' events mainly, then students are major and teachers are minor.

See the example schema also.

Any other column can be defined at each table table, as you like. Moreover, of course, any other table is also allowed in the database. Sharetary simply ignores them.

Typical use case: watching users' activities on the GitHub

This section describes how to crawl GitHub activities by fluentd, on a Ubuntu 14.04 server.

  1. Install Groonga with the instruction. (If you have your existing Groonga or Droonga, you can skip this step.)

  2. Install fluentd and td-agent.

    $ sudo apt-get install ntp
    $ sudo service ntp restart
    $ curl -L http://toolbelt.treasuredata.com/sh/install-ubuntu-trusty-td-agent2.sh | sudo sh
    $ sudo mkdir -p /var/spool/td-agent/buffer/
    $ sudo chown -R td-agent:td-agent /var/spool/td-agent/
    
  3. Install required fluentd plugins.

    $ sudo td-agent-gem install fluent-plugin-github-activities
    $ sudo td-agent-gem install fluent-plugin-record-reformer
    $ sudo td-agent-gem install fluent-plugin-filter_typecast
    
  4. Install fluent-plugin-groonga. It requires some extra packages.

    $ sudo apt-get install ruby ruby-dev build-essential
    $ sudo td-agent-gem install fluent-plugin-groonga
    
  5. Configure td-agent.

    $ sudo vi /etc/td-agent/td-agent.conf
    

    See also the example configuration to crawl and load GitHub activities. It includes rules to convert fetched GitHub activities to Sharetary events.

    It is recommended to put your GitHub access token in td-agent.conf. You can obtain it here.

  6. Start td-agent.

    $ sudo service td-agent start
    

How to customize exporting columns in CSV?

By default the link "CSV" in "Export" menu exports only some major columns. If you need, you can customize columns of exported records. Steps to change exporting columns are:

  1. Copy the link location of the menu item.
  2. Paste it to the location bar of your browser.
  3. Add new query parameter columns and load it.
    • Any columns of the Events table can be specified, like: ...&columns=title
    • Multiple columns can be available as comma-separated list like: ...&columns=title,actor
    • Special column name * (or all) is available to export all columns of the Events table.

sharetary's People

Contributors

kenhys avatar piroor avatar qzwpq avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

sharetary's Issues

fluentdのsharetaryに対する適切な設定方法がわからない

期待する結果
READMEの通りに設定すればタイムラインが流れる

実際の結果
タイムラインが流れずどこの設定が間違っているのかわからない
トラブルシューティングがないため、どのように問題を解決すればよいかわからない

Is `database` dir packed on a purpose?

Disclaimer: I do not use the package, this was found during automated npm packages downloading.

Your current package size is 0.9 MiB packed, 271 MiB unpacked. 269 MiB of that are inside the database dir. I suspect that this probably got packed to the release by mistake.

If you don't want to pack that directory, add it to the .gitignore and/or .npmingore.

Archive viewにて登録数が多いタグを表示した際に読み込みに時間がかかる

例えば http://sharetary.clear-code.com/archive において、タグとして"2015-sezemi-hack-4-beginners"を選
択すると、7.6MBのページをダウンロードするのに130kb/sで1分程度掛かりました。(環境によるとは思いますが)
読み込み中はスクロールバーが縮小し続けるために操作しづらく、待ち続けることになります。

汎用的で使用されやすいタグの場合、データサイズが大きくなりがちだと思いますので、ページ単位に区切るな
どしたほうが良いのではないでしょうか。

sampleディレクトリの説明

リポジトリの中にsample用のコードがあるが
README.mdの中で何も説明されていない。

Typical use case: watching users' activities on the GitHub
で用いるソースコードもあるはずなので
手順の中にsample/へのリンクを貼ったほうがよいと思う。

フィルターのタイムスタンプが指定しづらい

年月日の指定が valid でない年月日を指定できてしまう。
例えば、年月日にマイナスが指定できたり、月に13以上を指定できたりしてしまう。
時分秒も同様。

範囲外の値を指定できないようにしてほしい。
あと、年はデータベースに入っている最大と最小で入力できる範囲を決められるといいと思う。

年月日をカレンダーで指定できるとさらに良いと思う。
時分秒は選べなくてもいいような気がした。

チュートリアルの切り分け

実際に動かしてみようと思ったが
環境構築などの動かすために必要な手順が
どこに書いてあるかわかりにくかった。

README.md内のTypical use caseの名前をTutorialなどに変更するか
もっと最初の方で説明してほしい。
また、fluentd や groonga など必要なツールがいくつかあり、
説明の量が多くなりそうなので
INSTALL.mdなどのように別のファイルで説明したほうがよいかもしれない

sharetary サーバ起動時の反応

サーバを起動するコマンド

$ sharetary-server

でサーバが実際に起動しているかを確認したい。

しかし、上記のコマンドを入力して
サーバの起動に成功しても何も反応が返ってこないため

$ sharetary-server
Successfully Start Server

のように、ログを表示してほしい

データベース内に多数のtagが登録されている時のフィルタ設定modalの改善

  1. tagを手入力する(最初のUI)
    • 利点:場所を取らない。
    • 欠点:どんなtagがあるかを把握していないと絞り込みができない。
  2. selectの結果に付随するdrilldownの結果として得られるtagの一覧をチェックボックス形式で表示する(0.3.0~0.4.0の間で試していた)
    • 利点:
      • それほど場所を取らない。
      • 簡単に条件を指定できる。
    • 欠点:timelineやarchiveにおいて、「今の検索条件」に該当する範囲内のtagしか表示されない。
      • 例えば1回「clear-code/sharetary」がtagsに含まれているイベントのみに検索の範囲を絞り込むと、そのselect結果内でのdrilldownの結果に基づく情報としては、tagはclear-code/sharetaryしか見えない。(他のtagが設定されたイベントも表示したい、と思ったら1回検索条件を消去して検索し直さないといけない。「2015-sezemi-readable-code」での絞り込み後であればそれなりの数のtagのリストが得られるが、先に個々のプロジェクトのtagで絞り込んでからだと有用なtagのリストにならない)
  3. データベース内の全イベントを対象にselectした結果のdrilldown結果として得られるtagの一覧をチェックボックス形式で表示する(0.4.0)
    • 利点:簡単に条件を指定できる。
    • 欠点:データベース内のtag数が多い時に、チェックボックスのリストが長大になる。

上記を踏まえた改善の思案

  • tag以外の条件を適用してselectした結果に付随するdrilldown結果を使う。
    • 利点:簡単に条件を指定できるという利点を保ちつつ、一度に表示されるチェックボックスのリストを短くできる。
    • 欠点:
      • tagのリストを得るためだけに1回selectを実行する必要がある。
        • 不要なリクエストが発生しないように、tagのチェックボックスのリストが必要になる直前までselectのリクエストを行わないようにすると良いか?
      • 他の検索条件が指定されていない状態だと、やはりチェックボックスのリストが長大になる。

チェックボックス形式以外のUIを使った方が良いか?

Fluentdの設定例からfluent-plugin-mapをなくす

  • fluent-plugin-mapは開発が止まっているようである。
  • fluent-plugin-mapの設定はどうしても横に長くなってしまう。
  • fluent-plugin-mapはライセンスが未設定である。

ということで、可能であるならば他のプラグインに移行したい。
移行先プラグインに求められる性質:

  • 元のレコードと全く異なる形のレコードを出力できる。
  • 元のレコードにフィールドを追加した形のレコードを出力できる。
  • tagsフィールドについて、既存の値を残しつつ新しい値を追加できる。
  • 文字列以外の型のフィールドも出力できる。
  • 設定が横に長くなりすぎない。1フィールド1行で定義できる。
  • 単一プラグインでは不可能でも、他のプラグインとの組み合わせで上記を実現できるのであればそれでもよい。

検討中の移行先:fluent-plugin-record-reformer

データベース内に多数のactorが登録されている時のフィルタ設定modalの改善

  1. actorを手入力する(最初のUI)
    • 利点:場所を取らない。
    • 欠点:どんなactorがいるかを把握していないと絞り込みができない。
  2. selectの結果に付随するdrilldownの結果として得られるactorの一覧をチェックボックス形式で表示する(0.3.0~0.4.0の間で試していた)
    • 利点:
      • それほど場所を取らない。
      • 簡単に条件を指定できる。
    • 欠点:timelineやarchiveにおいて、「今の検索条件」に該当する範囲内のactorしか表示されない。
      • actorは排他的な条件なので、絞り込み条件を増やすと、例えば1回piroorがactorであるイベントのみに検索の範囲を絞り込むと、そのselect結果内でのdrilldownの結果に基づく情報としては、actorはpiroorしか見えない。(他のユーザのイベントも表示したい、と思ったら1回検索条件を消去して検索し直さないといけない。)
  3. データベース内の全イベントを対象にselectした結果のdrilldown結果として得られるactorの一覧をチェックボックス形式で表示する(0.4.0)
    • 利点:簡単に条件を指定できる。
    • 欠点:データベース内のactor数が多い時に、チェックボックスのリストが長大になる。

上記を踏まえた改善の思案

  • actor以外の条件を適用してselectした結果に付随するdrilldown結果を使う。
    • 利点:簡単に条件を指定できるという利点を保ちつつ、一度に表示されるチェックボックスのリストを短くできる。
    • 欠点:
      • actorのリストを得るためだけに1回selectを実行する必要がある。
        • 不要なリクエストが発生しないように、actorのチェックボックスのリストが必要になる直前までselectのリクエストを行わないようにすると良いか?
      • 他の検索条件が指定されていない状態だと、やはりチェックボックスのリストが長大になる。

チェックボックス形式以外のUIを使った方が良いか?

監視対象外のユーザが管理しているプロジェクトへのPRがマージされた事を検知する方法を確立する

現在は、監視対象範囲内のユーザの動向のみがクロールされるため、外部のプロジェクトに対するPRがマージされても、その旨はアクティビティとしては流れてこない。
PR作成先のプロジェクトも自動的に監視対象にするなどの対策が必要か?
(とりあえず2015年度SEゼミの範囲で問題が起こらない(関係者全員が監視対象になる前提であるなど)のであれば、対応は後回しにして良い)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.