perftools / xhgui

Web interface for XHProf profiling data can store data in MongoDB or PDO database
1.65k stars 342 forks source link

How to differentiated between domains? #125

Closed thebeline closed 3 years ago

thebeline commented 9 years ago

I am running this on multiple domains, how do I differentiate between them?

markstory commented 9 years ago

From the profile list you cannot, the only way you can separate domains is by looking at each profile run. Until this feature gets built, it might be best to run separate instances of xhgui. Alternatively, you could take a stab at building the domain filtering :smile:

thebeline commented 9 years ago

An update: This is actually built, it is just not fully integrated/prettyified.

The SERVER global is logged for each run, meaning we have access to really all identifying information for a run, including the Domain, the Hostname, the Host IP, the Remote IP, the Request Type and enough data to indicate SSL, etc.

Filtering to a specific domain is trivial in the Custom View, enter this into the Selection Criteria:

{"meta.SERVER.HTTP_HOST" : "www.domain.com"}

The primary issue here is that I can not access the profile for the returned results.

Also, there is no way to save these custom views, even as a bookmark.

So, that said, I think I will add a couple of commits.

preinheimer commented 9 years ago

On the XHProf UI I handled this by putting some drop downs in the page header for the domain and server. When set they filtered every search based on that criteria.

PRs very much welcome :)

thebeline commented 9 years ago

I have been thinking about this, and I think we need to break the "search" out into its own controller (much like "Custom/Query") and it's own Record method, and update all pages to use ajax to query and build their tables (for Runs).

This will unify the search and filtering capabilities of all pages, and could even allow for custom "Tabs" (saved, maybe in a cookie).

In the JSON response we would include all headers to display, including the Columns "Name", "Type", "Link Base" and "Link Source".

What the client does with this data is up to it, but for our purposes:

Example:

{
    'headers' : {
        'url' : {
            'name' : 'URL',
            'type' : 'string',
            'link_base' : '/url/view?url=',
        },
        'time' : {
            'name' : 'Time',
            'type' : 'datetime',
            'link_base' : '/run/view?id=',
            'link_source' : 'id',
        },
    },
    'data' : [
        {
            'id' : '2499804d22dca100251297c1',
            'url' : '%2Fdirectory%3Fcat_id%26prod_id',
            'time' : 9757658765,
        },
        ...
    ]
}

The idea is you would only display the columns that have corisponding headers (ie, you would not render the id column, because there is no header for it, but it is there for use as a link_source for 'time').

The other option is the system doesn't rend any header information, and just the runs data, and the template takes it from there. I like the first option, as it allows for some semantic information, but either way.

The general idea is to make all Runs Lists behave the same way, using the same methods. This will allow better flexability, and unify the look and feel (right now, the Custom View does not render the Date Times, or give any links).

The cool part, as I mentioned, would be that this would allow custom Tabs fairly easily, as most of the Tabs are currently just variations on sorting (Longest Wall Time, Most CPU, Most Memory). I could easily set up a tab with search params that gives Most CPU on Server X.

With custom Tabs, I would imagine no way to save them, just an option to delete a Custom Tab, or Add New Custom Tab with Current Parameters. Of course, you could change the parameters while looking at the Tab, but they would not be persistent (refrresh and the Tab is reset to it's saved state).

If you like the sound of that, I am going to work on making a certral and reusable query method and return format, then work to make the various tabs use that one location, and one template. Wish me luck.

markstory commented 9 years ago

I like the idea around making the main list page the same underlying code as custom query. Having some simple to use filters, and the advanced query options sounds great.

Building custom tabs is also pretty neat sounding.

Mte90 commented 6 years ago

Ping for this, there is a way to add the domain instead of only urls (without domains)?

markstory commented 6 years ago

@Mte90 Not yet. I haven't had the need for it personally and no one has submitted a pull request to add it.

Mte90 commented 6 years ago

It is very strange because we have /a-slug-of-the-url but no demo.test/a-slug-of-the-url. Where is required to change that? I can try to do something.

markstory commented 6 years ago

@Mte90 when data is saved by the collector https://github.com/perftools/xhgui-collector/blob/efbc19d2a0aa7905b1fc4a38baedc4a9f716a56e/external/header.php#L160 we would need to track the host separately. Having that would allow the ui to create host specific displays or allow searching by host.

Mte90 commented 6 years ago

As I can see store the $_SERVER but this doesn't already include the domain on $_SERVER['SERVER_NAME']?

markstory commented 6 years ago

Good point. The server data also contains the host.

Mte90 commented 6 years ago

So we need to change only the UI to show that data to start only on the list and later on the rest?

markstory commented 6 years ago

I suspect it isn't a simple change, but that sounds like a good place to start.

Mte90 commented 6 years ago

Started working on show the domain https://github.com/perftools/xhgui/pull/243

Mte90 commented 5 years ago

any updates for this? I am integrating xhgui on VVV and there is the support of multiple domains. I don't think that I have time to work on that right now.

markstory commented 5 years ago

any updates for this?

Not really. I haven't had much time to dedicate to this project recently.

glensc commented 3 years ago

Showing hostname in listing was added in #243 (0.10.0)

For filtering, there's still open issue: https://github.com/perftools/xhgui/issues/63