Coder Social home page Coder Social logo

bastian / bstats Goto Github PK

View Code? Open in Web Editor NEW
146.0 11.0 33.0 1.52 MB

bStats collects data for plugin authors. It's free and easy to use!

Home Page: https://bstats.org/

License: MIT License

Makefile 9.82% Shell 90.18%
minecraft metrics bukkit spigot bstats bungeecord sponge

bstats's Introduction

bStats

The parent repository of the bStats project.

Repository structure

This repository contains all bStats repositories as submodules. These are

  • bstats-backend - The backend of bStats.
  • bstats-web - The (new) frontend of bStats.
  • bstats-legacy - The original backend and frontend of bStats.
  • bstats-metrics - The Java-based metrics classes of bStats.

Currently bStats is in a transition phase from the original backend + frontend to a complete rewrite. The "live" version of bStats is currently running with the old frontend and a combination of old and new backend. Which routes are served by which backend can be found in the nginx configuration at /prod/volumes/nginx/nginx.conf.

This repository also provides the development environment for bStats.

Clone repository

When cloning the repository, it is recommended to use the --recursive flag to clone the repository with all submodules.

git clone --recursive [email protected]:Bastian/bStats.git

Alternatively, you can also clone the submodules after cloning this parent repository by running

git submodule init && git submodule update

Start Development

There are some prerequisites for development:

  • Docker
  • Linux. WSL2 is recommended for Windows. MacOS should work but is untested
  • GNU Make (should be available on most Unix systems)

Additionally, you need a Firebase account place the firebase-config.json file and the service-account-file.json file inside the dev directory.

Then you can start all services by running make. The services will run in Docker containers, thus no additional dependencies like Node.js and npm are required (even though it is recommended to have them installed for your IDE tooling).

Start Production

The prod directory contains the production environment for bStats. Similar to the dev environment, you have to place the firebase-config.json file and the service-account-file.json file inside the prod directory. Additionally, you have to update the prod/volumes/bstats-legacy/config.json file with your Recaptcha secrets and replace the sessionSecret with a random (long) string of your choosing.

You can then start the services by running make start-prod.

Backups

Redis data is backed up to AWS S3. AWS credentials have to be provided in a AWS.env file in the prod directory. Afterwards, cronjobs can be set up with the add-backup-cronjobs.sh script in the prod directory.

A lifecycle configuration for S3 is given in the prod/s3-lifecycle-config.json file.

Disaster Recovery

Assuming the worst happens and the current bStats server explodes. To get back up running, start the prod environment on a new server once and stop it after it has successfully started. Then place the backup Redis dumps (dump.rdb) in the prod/volumes/redis/node-<x>m directory. Make sure that the dump file is the correct one for the current node. You can look at the prod/volumes/redis/node-<x>m/nodes.conf file to find out for which key-range the node is responsible. You can then start the prod again and everything should work again (if it is a new server with a new IP, you ofc also have to update the DNS settings in Cloudflare).

License

This project is licensed under the MIT License.

bstats's People

Contributors

bastian avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bstats's Issues

Change plugins to be identified by UUID rather than name

For example I am adding a new Plugin - thats has existed for over 10 years - up until now it use the old Metrics so I am switching it to bstats - but when I add the plugin it says it already exists despite the fact there is no plugin by that name listed.. This presents a problem from the point of view its highly likely there will be 2 plugins with the same name that are completely different - I think it would be smarter to assign a Plugin a UUID on the website and initialize it
Metrics metrics = new Metrics(plugin);
metrics.setPluginID();
metrics.addCustomChart(charts);

[Meta] Ideas to further improve the project

Hi there,

I'm a big fan of automating all the things and tests for a higher code quality and noticed some things that could be improved in this repository. ๐ŸŽ‰
Below are some ideas.

  • Write unit tests
  • Write E2E tests
  • Enable ESLint
  • Enable automatic tests and linting via a CI (e.g. TravisCI)
  • Add an .editorconfig file for consistent code style rules
  • Enable Greenkeeper to keep the dependencies up to date
  • Scan for potential vulnerabilities via e.g. snyk or nsp
  • Add PR and Issue templates for better issues and PRs
  • Consistent dependency range (^ vs ~ vs fixed)
  • Publish the project to npm (and add package.json entries like license, bugs, description, ...)

If you have any questions, I'm happy to elaborate or even assist - though my time for open source is limited.

Add shields like GitHub

I think it'd be really cool to portray on your plugin website / on spigot a "Shield" like GitHub has, where it would say "Server #/#" and "Players #/#" to show people interested in your plugin that this many servers are using it currently.

Drilldown Pie - not working as expected

Following scenario:
I have a plugin that has some number of inventory games. Every server can have different games and a different amount of games. Now I'd like to have a drilldown pie with the number of games on the first stage and the games distribution of all servers with the same number of games on the second stage.

        metrics.addCustomChart(new Metrics.DrilldownPie("games_drill_down", () -> {
            Map<String, Map<String, Integer>> map = new HashMap<>();
            Map<String, Integer> entry = new HashMap<>();
            for (String gameID : getPluginManager().getGames().keySet()) {
                entry.put(getOriginalGameName(gameID), 1);
            }
            map.put(String.valueOf(getPluginManager().getGames().size()), entry);
            return map;
        }));

I would expect that every plugin instance gets a weight of 1 for the first stage (it's 1 time n games). So if I have 4 servers with different numbers of plugins every server gets 25% of the cake. But instead, with the code above, the value on the first stage is given by the number of games (screenshots).

I am not 100% sure that this is an issue. Maybe you want the drilldown pie to act like this, but I was ecpecting a different behaviour.

Color

The color is okay and makes me think of Minecraft slightly, but it can be a bit overwhelming. I think it would be interesting to provide a color selector somewhere in the footer(or anywhere) to switch to other material color schemes.

Multiple plugins not reporting to bStats?

I have 4 plugins that currently all submit information to the bStats metrics system. and 5 current plugins on my production server

https://bstats.org/plugin/sponge/MMCReboot
https://bstats.org/plugin/sponge/MMCLogger
https://bstats.org/plugin/sponge/SimpleGamemode
https://bstats.org/plugin/sponge/mmcprefix

These are my plugins, all of which should be reporting that there is 1 server in france using it. (where mine is located), It showed this for when i tested my Reboot plugin before adding the rest and updated another plugin which included bStats.

Error: "Unknown software"

If you click on the server software "server implementation" of a plugin from the plugin list, you will get an error: {"error":"Unknown software"}

bstatsbug

bstatsbug

Some design/layout bugs and improvements.

I know these are pretty minor, so probably won't be very high on the priority list, but I'll list them anyway.

'Navigation' header in the menu is slightly clipped at the top

Menu button placement feels very odd, wouldn't a more fitting placement be here?

The password box on the login screen looks odd when using chrome's autofill.

Plugin author's name isn't mentioned once on the individual plugin pages.

No way to switch back to the default colour after having clicked 'Random color' (besides deleting cookies or waiting a year.. [or maybe there's a mechanism to delete them earlier?..])

Option to stay logged in longer than one session?

Not strictly design-related, but can you add a way to stay logged in for longer? It gets quite tedious to have to login each time. I know there are security concerns, but I'm thinking more along the lines of one of those 'remember me' boxes.

Canary category

CanaryMod is admittedly dead is some people's eyes - I prefer hibernating - we've used mcstats for some time now, internally to track users of CanaryMod and by extension NeptuneMod.

bStats has now been around long enough, that I'm happy to start using it with NeptuneMod and work its way into CanaryLib as a replacement for mcstats.


Talking more broadly than adding a Canary category, I'd like to pose the question as to whether having different categories is such a good idea? To me it seems like unnecessary fragmentation - forcing plugins to not be able to see their total stats from one location. As far as plugins go, platform should be irregardless when considering statistics other than platform statistics of course.

Randomize picture

It may interesting to randomly choose a picture for the photo in the hamburger menu, just from a set of 5-20 or something. Could make an email for people to submit their own screenshots.

This is the area I am talking about:

image

Opt-out by default :-(

To the detriment of statistics collection, It's looking more and more likely that Sponges plugin review guidelines are going to state that stats need to be opt-in by default.

This isn't a ticket to implement this yet, it may yet not make it into the guidelines.

I'm mostly asking to just see if you would be receptive to making the Sponge stats collection either:

  1. Opt out by default.
  2. Not send stats until the second run, if it remains opt-in by default.
  3. Halt the server or nag the administrator to make an explicit choice, until it's dismissed (either opt in or opt out, as long as it's explicit and clear)
  4. disable stats if snooper settings is disabled.

Do you have any other ideas? Parts of the team have been pretty vocal about at minimum not sending stats until users get a chance to opt out, if not need to opt-in for stats collection.

Bstats slow

And it doesn't show versions like "1.2.6a"!

Add "Universal" plugin category

I recently looked into transferring my plugins away from mcstats and ran into the problem that I can't add plugins that run on more than just one server software. In my case I have on that runs on both, Bukkit and BungeeCord servers. (And yes, selecting nothing does not work for those wondering)

I saw that other ticket about Sponge + Bukkit support and the issue that global stats are generated from that category. This could be avoided if the type of server the plugin is running on wasn't generated by the plugin's category on the site but send directly with the metrics request.

bstats.org down

I cannot open bstats, instead I get a cached version hosted by Cloudflare.

image

Forge mods ?

Do you think it could be possible to add a forge section?
Thus it will be possible to know the number of players using a mod?

Differentiate between 'regular' offline-mode and offline-mode due to BungeeCord

The "Online mode" statistic is a really nice thing to be able to refer to, however, it's usefulness is limited as the statistic doesn't truly represent the state. Servers which use BungeeCord will report as being 'offline' - when in most cases, they're are in fact authenticating, just via the proxy.

I notice the setting is currently represented by an integer (although I assume it may be converted to a boolean at some point internally??):
https://github.com/BtoBastian/bStats-Metrics/blob/master/bstats-bukkit/src/main/java/org/bstats/bukkit/Metrics.java#L215

Perhaps a third value could be added there using a value of 2 for Offline due to BungeeCord.

This would mean 'Online mode' would have the following possible values:

  • Online
  • Offline
  • Offline (BungeeCord)

Combined Global Statistics

I think it would be a good idea to have a global statistics page that is platform agnostic.

This would include similar data to the plugin pages but with data combined from every unique server, plus a graph or two showing which server software, then maybe one showing individual versions. This can help server owners and plugin creators to analyze this data to figure out what the information is like for the whole population compared to for just one plugin.

Drilldown pie charts

Today I had a good idea for some custom data for my plugin to send, and while a simple pie was an awesome option for me, I couldn't stop thinking that a drilldown pie chart would had fit even better for that case.

If it's not much of a chore, do you think you could implement these in the future?

[Question] Status of the Maven repo

Hi there,

thanks for the alternative to MCStats, since it's down again for several days, I'm currently looking for alternatives I can use and stumbled upon the relative young project bStats ๐Ÿ‘

What's your priority (and possible ETA) for the maven repository?
It's important for me, since it's much easier for me to check for updates. Currently I need to manually check if your gist updated.

Thanks,
Tim

Support multi-platform plugins

Some plugins, such as GriefPrevention, are able to run on both Spigot and Sponge. It would be nice if it was possible to register a plugin of bStats for multiple platforms.

Bukkit and Sponge together

I have a plugin called UltimateCore, which is available for both Bukkit and Sponge.
Both plugins send the same data, and I would like a way to combine the bukkit and sponge plugin into one, instead of both seperate plugins.
So one page which shows both data for the Bukkit and for the Sponge plugin.

(The bukkit plugin doesn't exist yet, the sponge plugin is at https://bstats.org/plugin/sponge/UltimateCore)

No option to reset password

Hi, I created an account on bstats, and I think Firefox remembered the incorrect password because it says I entered the wrong password.

So I tried looking for an option to reset the password and there is none, which kinda sucks because I have a plugin on there and now there is no way to manage it

Can you add an option to register an email address with an account? That way if you lose your password you can recover it

Statistics Filtering

I think it would be useful if statistics could be filtered based on other statistics. For example, filtering based on Minecraft version, it would be possible to see the distribution of certain statistics for a given Minecraft version, such as plugin versions or Java versions.

I'm not sure how feasible this would be to implement, but it would certainly provide some more useful insights into how plugins are being used.

HTTP error

Hi I have just added bStats in my plugin MobHunting and it works. (most of the time) :-)

BUT once in a while I get this HTTP error.

[MobHunting] Could not submit plugin stats of MobHunting javax.net.ssl.SSLException: Received fatal alert: internal_error at sun.security.ssl.Alerts.getSSLException(Alerts.java:208) ~[?:1.8.0_121] at sun.security.ssl.Alerts.getSSLException(Alerts.java:154) ~[?:1.8.0_121] at sun.security.ssl.SSLSocketImpl.recvAlert(SSLSocketImpl.java:2023) ~[?:1.8.0_121] at sun.security.ssl.SSLSocketImpl.readRecord(SSLSocketImpl.java:1125) ~[?:1.8.0_121] at sun.security.ssl.SSLSocketImpl.performInitialHandshake(SSLSocketImpl.java:1375) ~[?:1.8.0_121] at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1403) ~[?:1.8.0_121] at sun.security.ssl.SSLSocketImpl.startHandshake(SSLSocketImpl.java:1387) ~[?:1.8.0_121] at sun.net.www.protocol.https.HttpsClient.afterConnect(HttpsClient.java:559) ~[?:1.8.0_121] at sun.net.www.protocol.https.AbstractDelegateHttpsURLConnection.connect(AbstractDelegateHttpsURLConnection.java:185) ~[?:1.8.0_121] at sun.net.www.protocol.http.HttpURLConnection.getOutputStream0(HttpURLConnection.java:1316) ~[?:1.8.0_121] at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:1291) ~[?:1.8.0_121] at sun.net.www.protocol.https.HttpsURLConnectionImpl.getOutputStream(HttpsURLConnectionImpl.java:250) ~[?:1.8.0_121] at org.bStats.Metrics.sendData(Metrics.java:278) ~[MobHunting-4.3.7-SNAPSHOT-Bnull.jar:?] at org.bStats.Metrics.access$200(Metrics.java:26) ~[MobHunting-4.3.7-SNAPSHOT-Bnull.jar:?] at org.bStats.Metrics$2.run(Metrics.java:237) [MobHunting-4.3.7-SNAPSHOT-Bnull.jar:?] at java.lang.Thread.run(Thread.java:745) [?:1.8.0_121]

Plugin Information

You did mention adding customizable plugin pages with a description, so here are some optional features I think would be interesting:

  • A short and a long description of the plugin, depending on the location.
  • The ability to add a logo to your plugin, possibly a gallery of photos.
  • Some way to include a link for a plugin page and one for Github.
  • A way to embed or link to a video of the plugin. Embedding a Youtube video would work.

"Remember Me" option

(Enhancement) Please add a "Remember Me" option in the login screen so we don't have to repeatedly log in every time, thanks.

System information

first thing i noticed was that the system arch is not reporting correctly. the two servers i have it being tested on are both Intel(R) Xeon(R) CPU E5-2670 and it is being reported as amd64

Navigation image too high

The header image in the side-navigation obstructs parts of the "Navigation" subheader

Screenshot

Just a minor thing, but I thought I'd mention it :)

Order pie charts

Currently pie char pieces are all over the place, ordering them by size would be nice:
http://i.minidigger.me/2017/03/chrome_26_21-05-45.png
I don't think that highcharts has a option for that (couldn't find something in a 5min google, wanted to write a pr ๐Ÿ˜ข) so you will have to sort the data before you shove it into highcharts

Create cool buttons/badges with stats

A nice idea would be to create a system that provides JPG images with plugin's stats written in (a.k.a. badges/buttons), something like: "400 servers are using PluginName", a reference to bStats in the bottom right (for instance) and the HTML code (also BBCode) that includes the image with a link to the plugin page on bStats.

An example could be: https://i.imgur.com/cV6RzF4.png (it's really bad and done in 10 secs just to show the concept)
or the GitHub buttons (with counts) to fork and star a repo: https://buttons.github.io/
or something like this: https://github.com/dwyl/repo-badges

Allow more flexibility in plugin name

I have a library plugin that includes an external lib for plugins dependent on my plugin. In order to version incompatibility for plugins expecting a different version of that external lib, I've done some hackery to include the version name in my plugin's name. example-1.1. Unfortunately, the bStats website does not allow me to add this plugin to the site. Is it possible you can make the system a bit more lenient on plugin names?

Include server implementation in global/plugin stats

Currently the only way to get an overview what kind of servers are used is when the creators of these servers added statistics for their version under the Server Implementation category.

It would be a lot more useful if the plugin stats itself could read the server's implementation and report that. This way we could have some stats about distribution of different forks e.g. CraftBukkit vs. Spigot to decide which features our plugins can (not) support.

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.