misskey-dev / misskey

🌎 An interplanetary microblogging platform 🚀
https://misskey-hub.net/
GNU Affero General Public License v3.0
9.82k stars 1.32k forks source link

Misskey 13 does not populate active counts in nodeinfo API #10852

Open markrprior opened 1 year ago

markrprior commented 1 year ago

💡 Summary

If you query a Misskey 13 instance via the nodeinfo API the usage section is incomplete as both activeMonth and activeHalfyear have a value of undef. Misskey 12 instances report this information so some code changes between the versions must have altered this behaviour. A Misskey 13 instance has this information via its web interface but it would be useful if it was also available via this API.

🥰 Expected Behavior

As an example query https://oran.ski/nodeinfo/2.0 and it will return in part

'usage' => { 'localComments' => 0, 'users' => { 'total' => 1596, 'activeHalfyear' => 621, 'activeMonth' => 161 }, 'localPosts' => 48376 }, 'software' => { 'version' => '12.111.1', 'name' => 'misskey' },

🤬 Actual Behavior

If you query a version 13 server such as misskey.io using the same mechanism you receive

'software' => { 'name' => 'misskey', 'version' => '13.12.2' }, 'usage' => { 'users' => { 'activeMonth' => undef, 'total' => 179322, 'activeHalfyear' => undef }, 'localComments' => 0, 'localPosts' => 15427064 },

📝 Steps to Reproduce

  1. Query https://_instance_/.well-known/nodeinfo
  2. Follow href link returned
  3. Examine JSON data returned looking for the usage section

📌 Environment

Misskey version: 13.12.2 PostgreSQL version: Redis version: Your OS: Your browser:

yuriha-chan commented 1 year ago

The functionality seems to have been disabled due to performance issues (on servers with large number of registered users). Only hourly and daily actives are shown up on the chart. Maybe it should be implemented in a same way to AggregateRetentionProcessorService. If you're admin of the misskey server of small server you can simply uncomment the related section in https://github.com/misskey-dev/misskey/blob/develop/packages/backend/src/server/NodeinfoServerService.ts

markrprior commented 1 year ago

@yuriha-chan that's interesting but the other interesting bit was that I contacted the admin of misskey.io (where I have an account) and asked them about and they asked me to report it as a bug. Given that I only found Misskey 12 instances with it enabled I wonder if that means that it was turned off by default as part of the 12 to 13 upgrade but it wasn't clear that that was happening to the admins? In any case if it is reported via the web stats interface it seems strange that it would be a performance kit to add the data that is already available to the nodeinfo API.

yuriha-chan commented 1 year ago

The Misskey 12 implementation calculates the total number of active users per request to the nodeinfo API, as opposed to web stats, which only displays numbers that have already been aggregated. In addition, nodeinfo is hard-coded so that the monthly active count cannot be enabled without modifying the source code.

So we need to cache the active count records and be able to enable that feature. (by configuration or by default)

In any case, thanks for your efforts on this report.


Misskey 12では、nodeinfo APIへのリクエストごとにアクティブユーザーの合計を計算していましたが、すでに集計された数字しか表示しないWeb statsとはことなり、パフォーマンスの問題があったようです。そのため、月間(半年)アクティブの数字は無効化されています。そして、その無効化はnodeinfoにハードコーディングされており、毎月のアクティブ数はソースコードを修正しないと有効にすることができないようになっています。

そこで、アクティブ数の記録をキャッシュするようにして、その機能を設定で切り替えられるか、常に有効にするようにする必要があります。

markrprior commented 1 year ago

@yuriha-chan that's very curious. It would seem that other software, such as mastodon, update the numbers presented via the nodeinfo API (or their own APIs) on a schedule rather than on a request basis so if you make the request multiple times within a short period you get the same cached value. In mastodon v3 this seemed to be updated daily but mastodon v4 does it every 30 minutes.

xtexChooser commented 1 year ago

It does not follow the schema (although I think this schema is full of problems

The property '#/usage/users/activeHalfyear' of type null did not match the following type: integer in schema http://nodeinfo.diaspora.software/ns/schema/2.1#
The property '#/usage/users/activeMonth' of type null did not match the following type: integer in schema http://nodeinfo.diaspora.software/ns/schema/2.1#
dansup commented 1 month ago

A MAU count would go a long way for https://fedidb.org and the fediverse at large to give a better aggregate MAU count!

markrprior commented 1 month ago

I would certainly appreciate it for my counter https://mastodon.social/@fediversecounter even if it the counters were cached once a day. At the moment it is not really possible to automatically judge which instances are active, nor how active they are, except via post count.