All handlers metrics except for "subroute" stopped after upgrading to 2.6

1. Output of caddy version:

v2.6.2 h1:wKoFIxpmOJLGl3QXoo6PNbYvGW4xLEgo32GPBEjWL8o=

2. How I run Caddy:

a. System environment:

Ubuntu 20.04.5 LTS on a DigitalOcean droplet. Not containerized within the droplet.

b. Command:

caddy reload Caddyfile

c. Service/unit/compose file:

I don’t have one.

d. My complete Caddy config:

{
        servers {
                metrics
        }
}

youngren.io www.youngren.io {
        encode gzip
        root * /var/www/youngren.io
        log {
                output file /var/log/caddy/youngren.io/access.log
        }
        file_server
}

ems.youngren.io {
        encode gzip
        root * /var/www/ems.youngren.io/build
        log {
                output file /var/log/caddy/ems.youngren.io/access.log
        }
        file_server
}

spacerocks.youngren.io {
        encode gzip
        root * /var/www/spacerocks.youngren.io
        log {
                output file /var/log/caddy/spacerocks.youngren.io/access.log
        }
        file_server
}

snake.youngren.io {
        encode gzip
        root * /var/www/snake.youngren.io
        log {
                output file /var/log/caddy/snake.youngren.io/access.log
        }
        file_server
}

fire.youngren.io {
        encode gzip
        root * /var/www/fire.youngren.io
        log {
                output file /var/log/caddy/fire.youngren.io/access.log
        }
        file_server
}

rpe.youngren.io {
        encode gzip
        root * /var/www/rpe.youngren.io/dist
        log {
                output file /var/log/caddy/rpe.youngren.io/access.log
        }
        file_server
}  

3. The problem I’m having:

When I look at my metrics in the Prometheus instance running on the same machine, all of the requests counts, save for handler=“subroute” went to 0 around the time I upgraded caddy. I would expect all of the metrics to continue to register after upgrading.

I will note here that I don’t fully understand the implications of the different metrics and have been relying on “file_server” to give me a general idea of the number of http requests as made by a user loading the website in a browser, which is the only thing I care about.

4. Error messages and/or full log output:

No error messages.

5. What I already tried:

Restarting caddy. I’ve read the caddy documentation on the “subroute” handler as well as the “file_server” handler but it’s not clear why one would keep working when the other stopped.

I should say that the extent of my caddy use is hosting these static sites and the extent of my prometheus use is trying to see how many hits these sites are getting. I know just enough to get it working. Or, I did.

6. Links to relevant resources:

Thank you for your time. :slight_smile:

As noted in the release notes, metrics are now opt-in in 2.6.

Hey @matt thanks for the response!

As you can see from the Caddyfile I posted, I have metrics enabled globally at the top, as specified in both the release notes and in the enabling metrics section of the documentation.

There are no other examples of different ways to turn metrics on by handler in the examples, but perhaps there’s something implied from some other section of the configuration documentation?

Anyway, it seems clear that it’s working since some metrics are still being reported, but I don’t understand why it’s only some and not all. Are you able to clarify that at all?

Thanks! :slight_smile:

1 Like

(Sorry, I was mobile and have the flu so I didn’t read very carefully.) That’s a good question, and I don’t know much about our metrics implementation unfortunately. Maybe someone else could help more?

1 Like

This topic was automatically closed after 30 days. New replies are no longer allowed.