Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
6b4cbe26
Commit
6b4cbe26
authored
Aug 18, 2015
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expose VCL probes to VMODs
parent
c9b0aa06
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
53 additions
and
19 deletions
+53
-19
directors.rst
doc/sphinx/reference/directors.rst
+2
-1
vmod.rst
doc/sphinx/reference/vmod.rst
+4
-1
vrt.h
include/vrt.h
+15
-14
vcc_backend.c
lib/libvcc/vcc_backend.c
+10
-3
vcc_compile.h
lib/libvcc/vcc_compile.h
+1
-0
vcc_expr.c
lib/libvcc/vcc_expr.c
+20
-0
vmodtool.py
lib/libvcc/vmodtool.py
+1
-0
No files found.
doc/sphinx/reference/directors.rst
View file @
6b4cbe26
...
...
@@ -150,4 +150,5 @@ too is no longer needed. It is then Varnish that will take care of health
probing and disabling the feature on cold VCL (see
:ref:`ref-vmod-event-functions`).
.. TODO document VCL_PROBE if patchwork #310 is merged
Instead of initializing your own probe definition, you can get a ``VCL_PROBE``
directly built from VCL (see :ref:`ref-vmod-vcl-c-types`).
doc/sphinx/reference/vmod.rst
View file @
6b4cbe26
...
...
@@ -193,7 +193,10 @@ PRIV_TOP
PRIV_VCL
See :ref:`ref-vmod-private-pointers` below.
.. TODO document PROBE if patchwork #310 is merged
PROBE
C-type: ``const struct vrt_backend_probe *``
A named standalone backend probe definition.
REAL
C-type: ``double``
...
...
include/vrt.h
View file @
6b4cbe26
...
...
@@ -67,20 +67,21 @@ struct ws;
* (alphabetic order)
*/
typedef
const
struct
director
*
VCL_BACKEND
;
typedef
const
struct
vmod_priv
*
VCL_BLOB
;
typedef
unsigned
VCL_BOOL
;
typedef
double
VCL_BYTES
;
typedef
double
VCL_DURATION
;
typedef
const
char
*
VCL_ENUM
;
typedef
const
struct
gethdr_s
*
VCL_HEADER
;
typedef
struct
http
*
VCL_HTTP
;
typedef
long
VCL_INT
;
typedef
const
struct
suckaddr
*
VCL_IP
;
typedef
double
VCL_REAL
;
typedef
const
char
*
VCL_STRING
;
typedef
double
VCL_TIME
;
typedef
void
VCL_VOID
;
typedef
const
struct
director
*
VCL_BACKEND
;
typedef
const
struct
vmod_priv
*
VCL_BLOB
;
typedef
unsigned
VCL_BOOL
;
typedef
double
VCL_BYTES
;
typedef
double
VCL_DURATION
;
typedef
const
char
*
VCL_ENUM
;
typedef
const
struct
gethdr_s
*
VCL_HEADER
;
typedef
struct
http
*
VCL_HTTP
;
typedef
long
VCL_INT
;
typedef
const
struct
suckaddr
*
VCL_IP
;
typedef
const
struct
vrt_backend_probe
*
VCL_PROBE
;
typedef
double
VCL_REAL
;
typedef
const
char
*
VCL_STRING
;
typedef
double
VCL_TIME
;
typedef
void
VCL_VOID
;
/***********************************************************************
* This is the composite argument we pass to compiled VCL and VRT
...
...
lib/libvcc/vcc_backend.c
View file @
6b4cbe26
...
...
@@ -249,7 +249,7 @@ void
vcc_ParseProbe
(
struct
vcc
*
tl
)
{
struct
token
*
t_probe
;
int
i
;
struct
symbol
*
sym
;
char
*
p
;
vcc_NextToken
(
tl
);
/* ID: probe */
...
...
@@ -258,11 +258,18 @@ vcc_ParseProbe(struct vcc *tl)
ERRCHK
(
tl
);
t_probe
=
tl
->
t
;
vcc_NextToken
(
tl
);
i
=
vcc_AddDef
(
tl
,
t_probe
,
SYM_PROBE
);
if
(
i
>
1
)
{
sym
=
VCC_GetSymbolTok
(
tl
,
t_probe
,
SYM_PROBE
);
AN
(
sym
);
if
(
sym
->
ndef
>
0
)
{
VSB_printf
(
tl
->
sb
,
"Probe %.*s redefined
\n
"
,
PF
(
t_probe
));
vcc_ErrWhere
(
tl
,
t_probe
);
return
;
}
sym
->
fmt
=
PROBE
;
sym
->
eval
=
vcc_Eval_Probe
;
sym
->
ndef
++
;
ERRCHK
(
tl
);
vcc_ParseProbeSpec
(
tl
,
t_probe
,
&
p
);
if
(
vcc_IdIs
(
t_probe
,
"default"
))
{
...
...
lib/libvcc/vcc_compile.h
View file @
6b4cbe26
...
...
@@ -280,6 +280,7 @@ sym_expr_t vcc_Eval_SymFunc;
void
vcc_Eval_Func
(
struct
vcc
*
tl
,
const
char
*
cfunc
,
const
char
*
extra
,
const
char
*
name
,
const
char
*
args
);
sym_expr_t
vcc_Eval_Backend
;
sym_expr_t
vcc_Eval_Probe
;
/* vcc_obj.c */
extern
const
struct
var
vcc_vars
[];
...
...
lib/libvcc/vcc_expr.c
View file @
6b4cbe26
...
...
@@ -516,6 +516,23 @@ vcc_Eval_Backend(struct vcc *tl, struct expr **e, const struct symbol *sym)
/*--------------------------------------------------------------------
*/
void
vcc_Eval_Probe
(
struct
vcc
*
tl
,
struct
expr
**
e
,
const
struct
symbol
*
sym
)
{
assert
(
sym
->
kind
==
SYM_PROBE
);
vcc_ExpectCid
(
tl
);
vcc_AddRef
(
tl
,
tl
->
t
,
SYM_PROBE
);
*
e
=
vcc_mk_expr
(
PROBE
,
"&vgc_probe_%.*s"
,
PF
(
tl
->
t
));
(
*
e
)
->
constant
=
EXPR_VAR
;
/* XXX ? */
vcc_NextToken
(
tl
);
}
/*--------------------------------------------------------------------
*/
void
vcc_Eval_Var
(
struct
vcc
*
tl
,
struct
expr
**
e
,
const
struct
symbol
*
sym
)
{
...
...
@@ -812,6 +829,8 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
sym
=
NULL
;
if
(
fmt
==
BACKEND
)
sym
=
VCC_FindSymbol
(
tl
,
tl
->
t
,
SYM_BACKEND
);
if
(
fmt
==
PROBE
)
sym
=
VCC_FindSymbol
(
tl
,
tl
->
t
,
SYM_PROBE
);
if
(
sym
==
NULL
)
sym
=
VCC_FindSymbol
(
tl
,
tl
->
t
,
SYM_VAR
);
if
(
sym
==
NULL
)
...
...
@@ -831,6 +850,7 @@ vcc_expr4(struct vcc *tl, struct expr **e, enum var_type fmt)
case
SYM_VAR
:
case
SYM_FUNC
:
case
SYM_BACKEND
:
case
SYM_PROBE
:
AN
(
sym
->
eval
);
AZ
(
*
e
);
sym
->
eval
(
tl
,
e
,
sym
);
...
...
lib/libvcc/vmodtool.py
View file @
6b4cbe26
...
...
@@ -60,6 +60,7 @@ ctypes = {
'PRIV_VCL'
:
"struct vmod_priv *"
,
'PRIV_TASK'
:
"struct vmod_priv *"
,
'PRIV_TOP'
:
"struct vmod_priv *"
,
'PROBE'
:
"VCL_PROBE"
,
'REAL'
:
"VCL_REAL"
,
'STRING'
:
"VCL_STRING"
,
'STRING_LIST'
:
"const char *, ..."
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment