Hi guys

I have a feature request, but that may be a support request. The function admin_menu_session_count() counts number of anonymous and authenticated users based on the entries in the sessions table. But when using a reverse proxy like Varnish, most of the anonymous page views are served by the RP, without any boostraping of Drupal. So the number of anonymous users displayed in the right corner of the admin menu bar is false.

I thought about several solutions :

  1. Hacking the module (booh!) to perform a simple calculation in order to adjust the number of an. sessions. Code would look like this :
    - $count_anon = admin_menu_session_count($interval, TRUE);
    + $count_anon = $rp * admin_menu_session_count($interval, TRUE);
    // $rp is an estimation of the ratio of cache hits/cache misses based on Varnish stats
    

    I'm clearly not in favor of this custom hack, bad practice.

  2. Have a custom configuration outside of Drupal, with an ESI for instance, where a small javascript bootstraps Drupal and add an entry in the session table. For high traffic website, it would also mean using something like RabbitMQ or another queue system to pile up the anonymous cache hits and write it back to the session table once a minute for instance.
    A performance problem because one RP cache hit = one entry in the session table
  3. Have a similar configuration than point number 2, but write the count in another table (just a timestamp and number of hits in each row for instance, it's lighter since we only need the count and a timestamp for an approximate timerange) and allow admin_menu to query this table instead of the normal session table
    It's been the second company where some custom solution with this other table has been put in place. So I really think this would be the best solution for admin_menu to take this kind of solution into account.

So I'm in favor of solution 3. Clearly I understand that it's not really the problem of admin_menu and more the problem of how Drupal core handles visit statistics, but if it could just allow for a custom query instead of the query against the sessions table from the admin_menu_session_count() function it would already "officially" enable this kind of solution. The implementation I've thought would be another setting (stored in the variables table) that would allow through the UI to write this custom query. I know it's dirty and insecure. Another way would be to allow this query to be written in the code, through the use of a hook or something equivalent.

Long issue I'm sorry. But the goal would be to show more accurate anonymous stats through reverse proxies. What do you think ?

Comments

DjebbZ’s picture

Maybe the best solution would be to allow a pluggable mechanism, where the admin_menu module would only provide the current solution, but another module would be able to write a plugin with another query. It may be the most "Drupally" solution, no ? I don't have the knowledge of implementing a plugin system (maybe as a hook, but not sure, since the various hooks would pile instead of overwriting the default query). I'm thinking that a default class in the admin_menu module would provide the default query, and a custom module would extend this class to provide another query, but not sure either.

truls1502’s picture

Status: Active » Postponed (maintainer needs more info)
Issue tags: +postponed2w

I am sorry for no reply until now.

There are many issues regarding this module admin_menu which is a bit difficult for us to follow up since some of the issues might be already outdated, or is already fixed by the module or any other modules or itself core which means that the problem might no longer need to be fixed.

We can see that the issue has been created for a few years ago, I hope it is okay for you that I am postponing the issue, and give you around two weeks. If you still face the problem, could you tell us the step by step when until you get the error message or what is frustrated you, and a list of modules you are using related to admin_menu and a screenshot that might help us? So it makes us easier to reproduce your issue.

However, after two weeks with no feedback - we will close this issue. So in case, you noticed it after the issue is closed, do not hesitate to reopen it like and fill information which is mentioned above.

So before giving us a feedback, do you mind to test it again with our latest 7.x-3.x-dev?

Thank you for understanding! :)

truls1502’s picture

Status: Postponed (maintainer needs more info) » Closed (cannot reproduce)
Issue tags: -postponed2w

This issue has been automatically marked as closed (cannot reproduce) because it has not had recent activity after the last post.

However, if you or someone is still facing the same issue as described to the issue, could you please to re-open the issue by changing the status of the issue, and add an explanation with more details which can help us to reproduce your situation.

Again, thank you for your contributions.