varnish / varnish-modules

Collection of Varnish Cache modules (vmods) by Varnish Software
Other
182 stars 86 forks source link

vmod_xkey: Add a n_xkey counter #151

Closed xordspar0 closed 4 years ago

xordspar0 commented 4 years ago

This adds a counter for the number of xkeys.

Co-authored-by: Ben Zvan ben.zvan@target.com

xordspar0 commented 4 years ago

In the future we plan to add a metric for the memory used by xkeys and possibly others.

xordspar0 commented 4 years ago

Oops, we made a mistake. This increments n_xkey for every backend request, even if the xkey already exists from a previous request. Test case incoming.

xordspar0 commented 4 years ago

☝️ That's fixed now.

xordspar0 commented 4 years ago

It looks like the Travis builds run against Varnish 4.1. That won't work for this since counters were first exposed to VMODs in 6.0. That's the reason for the configure script failure: in Varnish 4.1, the VARNISH_COUNTERS autoconf macro wasn't defined yet.

gquintard commented 4 years ago

Moving to circleci is on my plate, but with a low priority. I would warmly welcome a PR to setup circleci, or to update the Travis file, if you're up for it.

On Thu, Feb 27, 2020, 15:24 Jordan Christiansen notifications@github.com wrote:

It looks like the Travis builds run against Varnish 4.1. That won't work for this since counters were first exposed to VMODs in 6.0. That's the reason for the configure script failure: in Varnish 4.1, the VARNISH_COUNTERS autoconf macro wasn't defined yet.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/varnish/varnish-modules/pull/151?email_source=notifications&email_token=AA42AKKBAHXI5E4HDKNUMRTRFBDURA5CNFSM4K47UXS2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOENGLEYA#issuecomment-592228960, or unsubscribe https://github.com/notifications/unsubscribe-auth/AA42AKLNCCVEWNOMT3M4HETRFBDURANCNFSM4K47UXSQ .

benzvan commented 4 years ago

I just realized that makes any release of varnish-modules after this merge commit no longer backward compatible with varnish < 6.0. Probably fine though.

gquintard commented 4 years ago

totally fine, there's a varnish-module branch for each varnish-cache branch

xordspar0 commented 4 years ago

I don't have any experience with CircleCI, but I can definitely change the Travis config to point to a different version of Varnish.

dridi commented 4 years ago

The master branch should probably test the weeklies.

xordspar0 commented 4 years ago

It looks like vmod-bodyaccess has some build failures. It also has build failures master, but these failures are different. Is this related to the Varnish upgrade and should I fix them in this branch?

gquintard commented 4 years ago

a few things have (unexpectedly) changed in varnish, and bodyaccess needs to be updated. I'll try to have a look next week (unless you beat me to it, but in another branch), then we'll have a clear Travis view here

gquintard commented 4 years ago

@xordspar0, I've just pushed the body_access fixes, so you should be able to rebase without the .travis.yml commits and it should be fine.

Small bikeshedding: can you name the counter g_xkey_keys please? the g_ will make it clear it's a gauge, and having a xkey namespace will make additions easier to name in the future.

dridi commented 4 years ago

Small bikeshedding: can you name the counter g_xkey_keys please? the g_ will make it clear it's a gauge, and having a xkey namespace will make additions easier to name in the future.

I disagree with adding one more layer of namespacing, the gauge is already in the XKEY. namespace so really we should change it to XKEY.g_keys.

What other kind of keys do you think vmod_xkey would keep track of?

gquintard commented 4 years ago

The ever-watching Dridi is right, I didn't realize the counter was already in its own subsection. The gauge point still holds, so XKEY.g_keys is the way to go here.

gquintard commented 4 years ago

@xordspar0, I'm not sure you need that pointer, but it looks like we are missing the vsc file in EXTRA_DIST to make travis happy

dridi commented 4 years ago

My bad: https://github.com/varnishcache/varnish-cache/commit/8c91e49d1a516d86a1b84ac990c83c8d8cb3aa77

xordspar0 commented 4 years ago

Thanks! I was struggling to reproduce this locally since something weird is going on with pkg-config for my local builds.

xordspar0 commented 4 years ago

Alright, the build succeeds, the tests pass, everything seems to be working! Do you need me to squash or rebase my branch?

gquintard commented 4 years ago

I only added a couple of comments (style nitpick and the assert point). All good for me, but I'd like an extra amen from @Dridi or @nigoroll

gquintard commented 4 years ago

I'll merge at the end of the week if I don't hear any complaints

xordspar0 commented 4 years ago

Ok, that should resolve all comments so far.

gquintard commented 4 years ago

rebase, squash, and we should be good :-)

xordspar0 commented 4 years ago

Done.

gquintard commented 4 years ago

I'm merging, the rest, if any, can be handled later.

Thank you for this PR!