MCStats / Plugin Metrics (R7) - Easy & advanced Plugin Statistics

Discussion in 'Resources' started by Hidendra, May 25, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    Hidendra

    What is it?
    Plugin Metrics/ MCStats is a service that was created by myself around 5 months ago (the start of January). It serves to be more open than other closed-off plugin stats systems while at the same time striving to provide incredible possibilities in what can be done with it. All data is for the most part public and you can view the same data plugin authors can view.

    A very large percentage of Bukkit-enabled servers are somehow affected by Plugin Metrics / MCStats. There are over 80,000 servers reporting during peak times of the day (which is over 400 requests/second). Metrics represent over 500 plugins that make up our servers and define how our servers work. Of these are ones almost everyone will have heard of: Essentials, Vault, mcMMO, ChestShop, LWC, and many other excellent plugins. Even the Bukkit fork CB++ which is not a plugin uses this.

    What does it do?
    [​IMG]
    It does stat collecting. Much like Minecraft's official stats but this does not cover the same aspects Metrics covers. Plugins can optionally submit and graph custom data, for example Vault creates pie graphs of what Econ/Perm/Chat plugins are hooked.

    Metrics does not download any files to install itself. It is bundled directly with the plugin and reads from the same config file as every other metrics-enabled plugin. Some plugins add in a second opt out (which only one needs to be activated) and some allow you to opt out from in-game (for example, Essentials), however all will contain at least one opt-out inside plugins/Plugin Metrics/config.yml

    How am I affected?
    No server can be identified by IP. Servers that participate in Metrics and are not opted out identify themselves by a unique GUID which the server itself generated, it is not generated by my end.

    Why even create this?
    As the author of LWC I wanted to know usage stats but also did not want a proprietary solution. There was other stats providing services but I wanted something I could tweak and I imagined much more than just basic numbers. So I made it. And then opened it up to other authors and got the best feedback I could have gotten. From there it built up slowly and I have the plugin authors - those that create the plugins that shape our servers - to thank for the great success and progress we made which kept me motivated to add things others would enjoy.

    For us, we are surprised by the numbers we see and it will make some server owners mad to see this but it will not diminish our amazement for what we get from it. I personally lose from this venture but I've gained more than enough in experience and fulfillment to make up for it all.

    Ok, but what exactly is read/sent?
    It is not possible for Metrics to control the plugin in any way except for plugin-specific code the plugin author implements. As mentioned before, nothing is downloaded, so what you get is what the plugin author implemented.

    The following data is read from the server in some way or another:
    • File Contents of plugins/Plugin Metrics/config.yml (created if not existent)
    • Players currently online (not max player count)
    • Server version string (the same version string you see in /version)
    • Plugin version of the metrics-supported plugin
    • Mineshafter status - it does not properly propagate Metrics requests however it is a very simple check and does not read the filesystem
    The following data is sent to http://mcstats.org:
    • Metrics revision of the implementing class
    • Server's GUID
    • Players currently online (not max player count)
    • Server version string (the same version string you see in /version)
    • Plugin version of the metrics-supported plugin
    • Any custom data the supporting plugin implements. This is variable and I am not responsible for this however usually it is just plugin-specific data (e.g for LWC, the database type: MySQL or SQLite, and Locale used (english, german, etc))

    How do I really know you aren't doing something sketchy?
    The entire source (both frontend and business end) have been open-source from the very beginning. I've not seen other plugin stats services open source everything so I think this is a first. This transparency gives me a better assurance that it is better received and I also benefit from from pull requests, critique, and general banter around it. These can be found here: https://github.com/Hidendra/mcstats.org (frontend, old report processing backend) and https://github.com/Hidendra/MCStats (new reporting backend, in Java)

    What can I do?
    Plugin Metrics / MCStats would not be where it is today if not for the many plugin authors that have at least tried out this service. As well, I could not do it alone, and many of the ideas are a result of speaking with these same authors and throwing ideas around.

    As a plugin developer, you are free to use this service at absolutely no cost. There will never be ads or a "premium service" -- I cover all costs however donations are of course welcome but not required. The service is self-sustained and only requires my intervention to let you access your plugin in the admin panel. For more information please take a look here: https://github.com/Hidendra/Plugin-Metrics/wiki or join us in IRC

    As a server owner, you are free to question the service, welcome it, or deny it. All plugins that support Metrics use the same opt-out and as such you may opt out of further data at any time. You may ask myself any question and I will do my best to answer it -- I am as open as possible with Plugin Metrics / MCStats and hope this will help you understand what exactly it is.

    Opting out of this service can be done by editing plugins/Plugin Metrics/config.yml and changing opt-out to true. If this folder does not exist, you do not have any metrics-enabled plugins installed :)

    As anyone else, your input is extremely welcome. How you feel about it will allow me to make improvements and make it better for everyone as a whole.


    If you have any questions at all about how the service works or anything about Plugin Metrics/MCStats, please feel free to ask here or PM me, I (or anyone else) will do our best to answer it.

    also, join us in IRC, we have a lot of love to go around: irc.esper.net #metrics

    Thank you.
     
    PDKnight, Jovanos, AnorZaken and 29 others like this.
  2. Offline

    desht

    Great work on this. A truly useful service.
     
  3. Did you changed something some days ago in the name handling of plugins with a space? Because now I have a + instead of a space which created a new record for the same plugin. No changes were made in the plugin.yml what so ever.
     
  4. Offline

    Hidendra

    Which plugin? It was supposed to be a + but became a space for whatever reason at some point, I'll do a switcheroo on them to get the right one working
     
  5. We already have spoken on IRC some time ago, it's about Dragons Lair. It was working fine until 21st/22nd when it changed to the +. I changed some things in the code to get the old stats back and I got some 502 errors. At the end of the story, two plugins should be there, one with the plus and on with the space (shown as %20). Since it's not that much data I wouldn't care if you delete both or which one of them, just like to know which one should be used from then on.
    To prevent further duplicates: What about the idea of let the plugin authors creating the records first with the plugins name, so new records wouldn't get created if you changed the name of the plugin.yml, maybe accidentally. Since they're logged in while they're creating the record, it could automatically get hooked up to them which means less work for you as well (excluding projects with more than one author). I don't know if you actually already have tried it, but it would save you a lot of time.

    Sorry for the inconvenience caused :)
    ~kumpelblase2.
     
  6. Offline

    Gravity

    This is simply THE best service. The information/data you can collect and really take hold of and track is just amazing, and the dedication that Hidendra puts into this project is incredible. Thanks for this phenomenal system!
     
  7. Offline

    tyzoid

    I concur!
     
  8. Offline

    Hidendra

    indeed we have, those dates would've been when the new backend kicked in but it should be fixed now. I removed the ones that were only used once or twice (they had + and %20) and it looks to be ok now)

    i may certainly look into the latter, it sounds like a good idea and would fix multiple things (renaming plugins, no having to wait for me, etc.)

    thank you ;)
     
  9. Offline

    Don Redhorse

    I honestly must say I appreciate your work a lot Hidendra.

    ATM Metrics is with the ONLY reason why my plugins are still there, mainly because I KNOW there are some people using them beside me.

    Every admin who wants to opt out should really consider... and ask them self... what have I given back to the community, the developers who make it possible that I can run my server?

    I think some stats is the least anybody can do... to help the developer figure out what is required and if his plugin is appreciated.

    thanks to EVERYBODY still submitting stats... you make the work a little more worthwhile... and no it is not e-penis... it is just the feeling of having written / maintaining something people like..
     
  10. Offline

    Hidendra

    Agreed and well said ;) the amount of feedback we get on threads / devbukkit will always be significantly lower (and mainly only if there are bugs)
     
  11. Offline

    Sayshal

    Any chance some sort of 'hide-error-messages: true/false' could be added? Sometimes when the site is down for whatever reason, we (server admins) get spammed with plugin metrics HTTP errors.
     
  12. Offline

    Hidendra

    Well, I'm more interested in solving the root of the cause (not covering it with a pretty ribbon) so in that respect I think its been ok for the last 24 hours -- still some final kinks but good nonetheless
     
    KeybordPiano459 likes this.
  13. Offline

    Sayshal

    I wouldn't know personally, but as a big part of Bukkit Help. The "Omg what is this PluginMetrics spam?" threads are stacking up. Want me to try find some of them?
     
  14. Offline

    Hidendra

    Oh I probably don't want to know .... The reporting stuff is no longer ran on PHP which was the biggest issue. From here it's just smooth sailing.

    I idle in #essentials and "metrics" highlights me so I have a pretty good idea.
     
    Sayshal likes this.
  15. Every thought of putting an update feature into this ? By the way amazing plugin I love it for seeing my stats :D
     
  16. Offline

    Hidendra

    What do you mean by update feature?
     
  17. Sorry for not explaining it fully :confused:, I meant since you have the current version and every thing set up with the check what about add the ability to download a new version of the plugin from a url if the the version is different to the version that it uploaded. Just a suggest :p
     
  18. Offline

    Gravity

    That's not really in the scope of the system
     
  19. It was just a suggest ;), Don't want to do it / cant do it then don't do it :p
     
  20. Offline

    Hidendra

    A nice little status page for the backend can now be found here: http://mcstats.org/status/

    Note that even if all of the workers are BUSY, connections are still processed. The workers are in the background, executing queries that don't need to be executed immediately.
     
  21. Offline

    Hidendra

    I need you! Most of you have probably noticed funky graphs with some malformed character in the name (e.g "EnabledFeatures" could become "En!bledFeatures" or "Enab,dFeatures" or any variation). It also affects any other data in the post request, but the graph name is the most obvious. This has been confusing me because they happen every 40-90 minutes and happen at the TCP level -- I first thought Java was related somehow (me reading input stream wrong somehow, etc), but after catching one of these red handed, a tcp dump shows that no, this is happening before it even hits nginx or Java.

    Then I noticed something: I looked up this server in the database, it was from Singapore. So I still had 2 older graph dumps of graphs that were doing it (2 servers) and noticed that they too were in Singapore. I then went into the database and collected some columns that were broken and pulled up every server that submitted data for these columns. They were all from Singapore. There is not one exception to a server being in Singapore that has submitted malformed data. This probably sounds like it's out of some sci-fi novel, but I'm confused as to why this is happening and why Singapore.

    Graph names are hardcoded into these plugins (at least Essentials, the one I was spying on) so there is no encoding mismatches (or shouldn't be?). It's URL encoded to UTF-8 and then shipped off to me. Other countries with non-latin languages i.e Russia, Japan, etc do not have this problem. It's only Singapore. So why is Singapore pillaging the bytes?

    In total, there was (at the time of this post) 384 active Singapore servers in the last 24 hours. In total, there has only ever been 3.9k servers from Singapore. I have two options:
    • Blacklist Singapore. The more effective and immediate option but also blacklists valuable data. It also leaves questions unanswered.
    • Fix it, somehow. I do not know why or how this is causing bytes to be transformed to something else before even arriving at my server.

    I also believe this is not intentional. From the data I've seen in the database itself, you would need to be crazy to put something on at this scale.

    If anyone has an answer or even an idea as to this, I'd appreciate it. Thank you
     
  22. Offline

    ZachBora

  23. Offline

    Hidendra

    I'm not really familiar with the technical side of censorship -- ISPs that do any kind of censorship, wouldn't they either just block or redirect requests entirely? Randomly changing one character to something else seems very uncensor like to me but of course isn't out of the question if their system is broken

    edit:

    it's related to another problem that's being visited now, it should be mostly fixed if not fully, won't know for a little while
     
  24. Offline

    tyzoid

    Did you check if it is an encoding problem?

    Probably not, but it's nice to make sure.
     
  25. Offline

    Hidendra

    Yeah. The key/value pairs in the post req are directly encoded via URLEncoder.encode(blah, "UTF-8") so I don't believe I can do that wrong.

    Also, capacity issues are now fixed -- an extremely volatile table was converted to MEMORY so it does not use the disk and hammer it like a truck (even if I truncate the table, it'd have fully live data again in less than 10 minutes, from 0 to >1 million rows in those 10 minutes before stabilizing around 2). Thanks to KHobbits for the idea

    I've removed the drops caused by queue overflow (now does not happen) and will look into fully removing malformed columns and graphs later on.
     
  26. Offline

    Hidendra

    Over the next few days I (hope) to start consolidating the Global Statistics graph to use the much better custom data framework which will eventually be more expansive once everything is in place. This will eventually see a more general name.

    This will mean that the global stats graph will be somewhat editable. The name won't be but the graph type and scale should be changeable (I'll see after testing starts going underway)

    This will not result in any data loss.

    Alongside SUM() (what is currently being used), as of last night the following are now being scraped from anything that uses custom data:
    • COUNT (number of servers that participated in the graph entry)
    • MAX and conversely, MIN
    • AVG
    • VAR_SAMP (sample standard variance)
    • STDDEV_SAMP (sample standard deviation)

    These are not being immediately used but will allow me to use them as I see fit in the future.

    Moving the global stats graph will allow me to immediately use these instead of duplicating code everywhere.
     
  27. Offline

    ZachBora

    That sounds promising. I was wondering if there was a way to make a graph submit multiple times, once for each world. Do I just add a loop around my current code for each worlds?

    https://github.com/ZachBora/PlotMe/blob/master/src/com/worldcretornica/plotme/PlotMe.java#L98
     
  28. Offline

    Hidendra

    your best bet would to loop I imagine. if you submit a graph multiple times (which has an identical name), the plotters will overwrite the previous value they sent (so 'Average Plot Size' sends a value of 5, next time it sends, say 7, it doesn't "add", it sees that your server last sent 5 for that graph/plotter, so it simply overwrites the 5 with 7)
     
  29. Offline

    ZachBora

    Ideally, what I would like is a bar graph that shows plot size (which is a per world configuration).
    Example :

    Server 1 : 1 world @ 32, 1 world @ 50
    Server 2 : 1 world @ 50
    Server 3: 1 world @ 250

    Bar graph :

    Z -> X
    1 @ 32
    2 @ 50
    1 @ 250
     
  30. Offline

    obnoxint

    Hidendra
    Just theoretically... what would happen if the encoded plotter value is bigger than Integer.MAXVALUE? Would the mcstats server still accept the value and process it correctly?
     
Thread Status:
Not open for further replies.

Share This Page