xcir / python-varnishapi Goto Github PK
View Code? Open in Web Editor NEWLicense: Other
License: Other
./vsldump.py[32535]: Traceback (most recent call last):
File "./vsldump.py", line 46, in main
smp.execute(vap)
File "./vsldump.py", line 12, in execute
ret = self.vap.Dispatch(self.vapCallBack)
File "/home/xcir/ex/libvmod-dump/tools/varnishapi.py", line 544, in Dispatch
i = self.__cbMain(cb,priv)
File "/home/xcir/ex/libvmod-dump/tools/varnishapi.py", line 537, in __cbMain
self.vslq = self.lva.VSLQ_New(self.vsl, POINTER(c), self.__g_arg, self.__q_arg);
TypeError: must be a ctypes type
Issue: When attempting to use python-varnishapi to read varnishlog dumped to binary file on disk, opening it with Varnishapi.VarnishLog() triggers assert in vsm.c.
Assert error in VSM_Get(), vsm.c line 1019:
Condition((vd->attached) != 0) not true.
python-varnishapi from pypi, version 60.24.
debian testing with Varnish 6.0.7 from packagecloud varnish60lts.
Using this snippet based on the examples:
#!/usr/bin/env python3
import varnishapi
from time import sleep
def cbline(vap, cbd, priv):
print(cbd)
def cbvxid(vap, priv):
print("VXID")
def cbgroup(vap, priv):
print("GROUP")
def main():
# vsl = varnishapi.VarnishLog(["-g", "request"])
vsl = varnishapi.VarnishLog(["-r", "foo.dump", "-g", "request"])
arg = {
"cb": cbline,
"vxidcb": cbvxid,
"groupcb": cbgroup,
"maxread": 0,
}
while 1:
ret = vsl.Dispatch(**arg)
if 0 == ret:
sleep(0.5)
print(".", end="")
vsl.Fini()
if __name__ == "__main__":
main()
fix proposal in #80
I'm using multiple Varnish named instances.
Here is the crash test with the latest version of the API, using Debian Jessie and its python 2.7.9
>>> import varnishapi
>>> vsc = varnishapi.VarnishStat(opt='-n translation')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "varnishapi.py", line 372, in __init__
self.__setArg(opt)
File "varnishapi.py", line 383, in __setArg
if self.__r_arg and self.vsm:
AttributeError: VarnishStat instance has no attribute '_VarnishStat__r_arg'
Hi,
Do you plan to support Varnish 4 ?
Thanks
With CLI, I can use:
varnishstat -n translation -1
It returns lots of stuff.
I want to do the same with python :
import varnishapi
vsc = varnishapi.VarnishStat(opt=["-n translation"])
r = vsc.getStats()
for k, v in r.iteritems():
print k, v
vsc.Fini()
Notice that opt is a list of string.
It print nothing.
When I debug, in __gestat, bool(pt) is False and pt is a varnishapi.LP_VSC_point. VSM_n_Arg return 1. Everything seems OK, but it returns nothing.
Hi,
there seems to be a bug in the way the -c switch is honored:
https://github.com/xcir/python-varnishapi/blob/master/src/varnishapi.py#L891
When passing -c, in case of VSL_t_req transactions the conditional on line 891 is False (because vsl[0].c_opt is True). However, the final conditional on line 895 is True, and the transaction gets ignored.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.