boynux / squid-exporter

Squid Prometheus Exporter
https://www.boynux.com/squid-exporter
MIT License
134 stars 53 forks source link

Website is down and lack of documentation #85

Closed JeroenMathon closed 1 year ago

JeroenMathon commented 1 year ago

My employer wants to use your container as a sidecar in our Kubernetes cluster, We receive all sorts of metrics in our prometheus cluster but we are struggling to decipher the meaning of some of these metrics, specifically the almost 100 squid_Cache_Hits_X and squid_Cache_Misses_Xmetrics.

One of the things we need to create is a Hit&Miss graph but its unclear which hits or misses we need to pick and what the meaning is of the number behind the metric.

It would help alot of we have documentation on what the number behind this metrics means, a google search nor analyzing the source code does not explain.

JeroenMathon commented 1 year ago

image

JeroenMathon commented 1 year ago

The lack of documentation makes this project unusable for anyone without prior experience with this project. I propose embedding the documentation into the project instead of hosting is on a dead domain.

This should be an easy and quick fix(Might not be clean) but at least the project remains usable.

JeroenMathon commented 1 year ago

After checking the file sevice_times.go i noticed a struct

type squidServiceTimes struct {
    Section     string
    Counter     string
    Suffix      string
    Description string
}

That would indicate that it is a suffix? Which is being called by serviceTime.Suffix

JeroenMathon commented 1 year ago

Managed to collect the metrics by hand, Hopefully this will give some insight

Trying 127.0.0.1...                                                                                                                                                                                                                                                                [76/1752]
Connected to 127.0.0.1.                                                
Escape character is '^]'.                                              
GET cache_object://localhost/service_times HTTP/1.0 
HOST: localhost                                                        

HTTP/1.1 200 OK                                                        
Server: squid/5.7                                                      
Mime-Version: 1.0                                                      
Date: Fri, 06 Oct 2023 09:36:41 GMT                 
Content-Type: text/plain;charset=utf-8              
Expires: Fri, 06 Oct 2023 09:36:41 GMT              
Last-Modified: Fri, 06 Oct 2023 09:36:41 GMT        
X-Cache: MISS from secure-5575c55dcf-wz6kp          
X-Cache-Lookup: MISS from secure-5575c55dcf-wz6kp:3128
Via: 1.1 secure-5575c55dcf-wz6kp (squid/5.7)        
Connection: close                                                      

Service Time Percentiles            5 min    60 min:
        HTTP Requests (All):   5%   0.00000  0.00000
        HTTP Requests (All):  10%   0.00000  0.00000
        HTTP Requests (All):  15%   0.00000  0.00000
        HTTP Requests (All):  20%   0.00000  0.00000
        HTTP Requests (All):  25%   0.00000  0.00000
        HTTP Requests (All):  30%   0.00000  0.00000
        HTTP Requests (All):  35%   0.00000  0.00000
        HTTP Requests (All):  40%   0.00000  0.00000
        HTTP Requests (All):  45%   0.00000  0.00000
        HTTP Requests (All):  50%   0.00000  0.00000
        HTTP Requests (All):  55%   0.00000  0.00000
        HTTP Requests (All):  60%   0.00000  0.00000
        HTTP Requests (All):  65%   0.00000  0.00000
        HTTP Requests (All):  70%   0.00000  0.00000
        HTTP Requests (All):  75%   0.00000  0.00000
        HTTP Requests (All):  80%   0.00000  0.00000
        HTTP Requests (All):  85%   0.00000  0.00000
        HTTP Requests (All):  90%   0.00000  0.00091
        HTTP Requests (All):  95%   0.00091  0.00091
        Cache Misses:          5%   0.00000  0.00000
        Cache Misses:         10%   0.00000  0.00000
        Cache Misses:         15%   0.00000  0.00000
        Cache Misses:         20%   0.00000  0.00000
        Cache Misses:         25%   0.00000  0.00000
        Cache Misses:         30%   0.00000  0.00000
        Cache Misses:         35%   0.00000  0.00000
        Cache Misses:         40%   0.00000  0.00000
        Cache Misses:         45%   0.00000  0.00000
        Cache Misses:         50%   0.00000  0.00000
        Cache Misses:         55%   0.00000  0.00000
        Cache Misses:         60%   0.00000  0.00000
        Cache Misses:         65%   0.00000  0.00000
        Cache Misses:         70%   0.00000  0.00000
        Cache Misses:         75%   0.00000  0.00000
        Cache Misses:         80%   0.00000  0.00000
        Cache Misses:         85%   0.00000  0.00000
        Cache Misses:         90%   0.00000  0.00091
        Cache Misses:         95%   0.00091  0.00091
JeroenMathon commented 1 year ago

Squid seems to export these metrics they get collected by this project so its outside of the scope of this project, Would help alot to know how to interpret these metrics into a useful graph but im closing this issue

statPctileSvc(double pctile, int interval, int which)
{
    StatCounters *f;
    StatCounters *l;
    double x;
    assert(interval > 0);

    if (interval > N_COUNT_HIST - 1)
        interval = N_COUNT_HIST - 1;

    f = &CountHist[0];

    l = &CountHist[interval];

    assert(f);

    assert(l);

    switch (which) {

    case PCTILE_HTTP:
        x = statHistDeltaPctile(l->client_http.allSvcTime,f->client_http.allSvcTime, pctile);
        break;

    case PCTILE_HIT:
        x = statHistDeltaPctile(l->client_http.hitSvcTime,f->client_http.hitSvcTime, pctile);
        break;

    case PCTILE_MISS:
        x = statHistDeltaPctile(l->client_http.missSvcTime,f->client_http.missSvcTime, pctile);
        break;

    case PCTILE_NM:
        x = statHistDeltaPctile(l->client_http.nearMissSvcTime,f->client_http.nearMissSvcTime, pctile);
        break;

    case PCTILE_NH:
        x = statHistDeltaPctile(l->client_http.nearHitSvcTime,f->client_http.nearHitSvcTime, pctile);
        break;

    case PCTILE_ICP_QUERY:
        x = statHistDeltaPctile(l->icp.querySvcTime,f->icp.querySvcTime, pctile);
        break;

    case PCTILE_DNS:
        x = statHistDeltaPctile(l->dns.svcTime,f->dns.svcTime, pctile);
        break;

    default:
        debugs(49, 5, "statPctileSvc: unknown type.");
        x = 0;
    }

    return x;
}
JeroenMathon commented 1 year ago

the number is the interval