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
a93c4555
Commit
a93c4555
authored
Jun 08, 2017
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Put the VSC->type (ie: MAIN, VBE etc.) into the ->ident field.
Also add back the "formats" property for VSC counters.
parent
8d5b1483
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
71 additions
and
53 deletions
+71
-53
main.vsc
bin/varnishd/main.vsc
+1
-0
mempool.vsc
bin/varnishd/mempool.vsc
+2
-0
sma.vsc
bin/varnishd/sma.vsc
+4
-0
smf.vsc
bin/varnishd/smf.vsc
+4
-0
vbe.vsc
bin/varnishd/vbe.vsc
+7
-0
varnishstat.c
bin/varnishstat/varnishstat.c
+3
-17
varnishstat_curses.c
bin/varnishstat/varnishstat_curses.c
+2
-8
u00005.vtc
bin/varnishtest/tests/u00005.vtc
+1
-1
vtc_varnish.c
bin/varnishtest/vtc_varnish.c
+5
-22
vsc.h
include/vapi/vsc.h
+0
-1
vsc.c
lib/libvarnishapi/vsc.c
+40
-4
vsctool.py
lib/libvcc/vsctool.py
+2
-0
No files found.
bin/varnishd/main.vsc
View file @
a93c4555
...
...
@@ -16,6 +16,7 @@
.. varnish_vsc:: uptime
:oneliner: Child process uptime
:format: duration
How long the child process has been running.
...
...
bin/varnishd/mempool.vsc
View file @
a93c4555
...
...
@@ -24,12 +24,14 @@
.. varnish_vsc:: sz_wanted
:type: gauge
:level: debug
:format: bytes
:oneliner: Size requested
.. varnish_vsc:: sz_actual
:type: gauge
:level: debug
:format: bytes
:oneliner: Size allocated
...
...
bin/varnishd/sma.vsc
View file @
a93c4555
...
...
@@ -26,6 +26,7 @@
.. varnish_vsc:: c_bytes
:type: counter
:level: info
:format: bytes
:oneliner: Bytes allocated
Number of total bytes allocated by this storage.
...
...
@@ -33,6 +34,7 @@
.. varnish_vsc:: c_freed
:type: counter
:level: info
:format: bytes
:oneliner: Bytes freed
Number of total bytes returned to this storage.
...
...
@@ -47,6 +49,7 @@
.. varnish_vsc:: g_bytes
:type: gauge
:level: info
:format: bytes
:oneliner: Bytes outstanding
Number of bytes allocated from the storage.
...
...
@@ -54,6 +57,7 @@
.. varnish_vsc:: g_space
:type: gauge
:level: info
:format: bytes
:oneliner: Bytes available
Number of bytes left in the storage.
...
...
bin/varnishd/smf.vsc
View file @
a93c4555
...
...
@@ -26,6 +26,7 @@
.. varnish_vsc:: c_bytes
:type: counter
:level: info
:format: bytes
:oneliner: Bytes allocated
Number of total bytes allocated by this storage.
...
...
@@ -33,6 +34,7 @@
.. varnish_vsc:: c_freed
:type: counter
:level: info
:format: bytes
:oneliner: Bytes freed
Number of total bytes returned to this storage.
...
...
@@ -47,6 +49,7 @@
.. varnish_vsc:: g_bytes
:type: gauge
:level: info
:format: bytes
:oneliner: Bytes outstanding
Number of bytes allocated from the storage.
...
...
@@ -54,6 +57,7 @@
.. varnish_vsc:: g_space
:type: gauge
:level: info
:format: bytes
:oneliner: Bytes available
Number of bytes left in the storage.
...
...
bin/varnishd/vbe.vsc
View file @
a93c4555
...
...
@@ -17,6 +17,7 @@
.. varnish_vsc:: bereq_hdrbytes
:type: counter
:level: info
:format: bytes
:oneliner: Request header bytes
Total backend request header bytes sent
...
...
@@ -24,6 +25,7 @@
.. varnish_vsc:: bereq_bodybytes
:type: counter
:level: info
:format: bytes
:oneliner: Request body bytes
Total backend request body bytes sent
...
...
@@ -31,6 +33,7 @@
.. varnish_vsc:: beresp_hdrbytes
:type: counter
:level: info
:format: bytes
:oneliner: Response header bytes
Total backend response header bytes received
...
...
@@ -38,6 +41,7 @@
.. varnish_vsc:: beresp_bodybytes
:type: counter
:level: info
:format: bytes
:oneliner: Response body bytes
Total backend response body bytes received
...
...
@@ -45,6 +49,7 @@
.. varnish_vsc:: pipe_hdrbytes
:type: counter
:level: info
:format: bytes
:oneliner: Pipe request header bytes
Total request bytes sent for piped sessions
...
...
@@ -52,6 +57,7 @@
.. varnish_vsc:: pipe_out
:type: counter
:level: info
:format: bytes
:oneliner: Piped bytes to backend
Total number of bytes forwarded to backend in pipe sessions
...
...
@@ -59,6 +65,7 @@
.. varnish_vsc:: pipe_in
:type: counter
:level: info
:format: bytes
:oneliner: Piped bytes from backend
Total number of bytes forwarded from backend in pipe sessions
...
...
bin/varnishstat/varnishstat.c
View file @
a93c4555
...
...
@@ -66,11 +66,7 @@ do_xml_cb(void *priv, const struct VSC_point * const pt)
sec
=
pt
->
section
;
printf
(
"
\t
<stat>
\n
"
);
if
(
strcmp
(
sec
->
type
,
""
))
printf
(
"
\t\t
<type>%s</type>
\n
"
,
sec
->
type
);
if
(
strcmp
(
sec
->
ident
,
""
))
printf
(
"
\t\t
<ident>%s</ident>
\n
"
,
sec
->
ident
);
printf
(
"
\t\t
<name>%s</name>
\n
"
,
pt
->
desc
->
name
);
printf
(
"
\t\t
<name>%s.%s</name>
\n
"
,
sec
->
ident
,
pt
->
desc
->
name
);
printf
(
"
\t\t
<value>%ju</value>
\n
"
,
(
uintmax_t
)
val
);
printf
(
"
\t\t
<flag>%c</flag>
\n
"
,
pt
->
desc
->
semantics
);
printf
(
"
\t\t
<format>%c</format>
\n
"
,
pt
->
desc
->
format
);
...
...
@@ -118,18 +114,12 @@ do_json_cb(void *priv, const struct VSC_point * const pt)
printf
(
"
\"
"
);
/* build the JSON key name. */
if
(
sec
->
type
[
0
])
printf
(
"%s."
,
sec
->
type
);
if
(
sec
->
ident
[
0
])
printf
(
"%s."
,
sec
->
ident
);
printf
(
"%s
\"
: {
\n
"
,
pt
->
desc
->
name
);
printf
(
"
\"
description
\"
:
\"
%s
\"
,
\n
"
,
pt
->
desc
->
sdesc
);
if
(
strcmp
(
sec
->
type
,
""
))
printf
(
"
\"
type
\"
:
\"
%s
\"
, "
,
sec
->
type
);
if
(
strcmp
(
sec
->
ident
,
""
))
printf
(
"
\"
ident
\"
:
\"
%s
\"
, "
,
sec
->
ident
);
printf
(
"
\"
flag
\"
:
\"
%c
\"
, "
,
pt
->
desc
->
semantics
);
printf
(
"
\"
flag
\"
:
\"
%c
\"
, "
,
pt
->
desc
->
semantics
);
printf
(
"
\"
format
\"
:
\"
%c
\"
,
\n
"
,
pt
->
desc
->
format
);
printf
(
"
\"
value
\"
: %ju"
,
(
uintmax_t
)
val
);
printf
(
"
\n
}"
);
...
...
@@ -177,7 +167,7 @@ do_once_cb_first(void *priv, const struct VSC_point * const pt)
op
=
priv
;
AZ
(
strcmp
(
pt
->
desc
->
ctype
,
"uint64_t"
));
sec
=
pt
->
section
;
if
(
strcmp
(
sec
->
type
,
"MAIN"
)
||
strcmp
(
pt
->
desc
->
name
,
"uptime"
))
if
(
strcmp
(
sec
->
ident
,
"MAIN"
)
||
strcmp
(
pt
->
desc
->
name
,
"uptime"
))
return
(
0
);
val
=
*
(
const
volatile
uint64_t
*
)
pt
->
ptr
;
op
->
up
=
(
double
)
val
;
...
...
@@ -199,8 +189,6 @@ do_once_cb(void *priv, const struct VSC_point * const pt)
val
=
*
(
const
volatile
uint64_t
*
)
pt
->
ptr
;
sec
=
pt
->
section
;
i
=
0
;
if
(
strcmp
(
sec
->
type
,
""
))
i
+=
printf
(
"%s."
,
sec
->
type
);
if
(
strcmp
(
sec
->
ident
,
""
))
i
+=
printf
(
"%s."
,
sec
->
ident
);
i
+=
printf
(
"%s"
,
pt
->
desc
->
name
);
...
...
@@ -244,8 +232,6 @@ do_list_cb(void *priv, const struct VSC_point * const pt)
sec
=
pt
->
section
;
i
=
0
;
if
(
strcmp
(
sec
->
type
,
""
))
i
+=
printf
(
"%s."
,
sec
->
type
);
if
(
strcmp
(
sec
->
ident
,
""
))
i
+=
printf
(
"%s."
,
sec
->
ident
);
i
+=
printf
(
"%s"
,
pt
->
desc
->
name
);
...
...
bin/varnishstat/varnishstat_curses.c
View file @
a93c4555
...
...
@@ -276,8 +276,7 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
CAST_OBJ_NOTNULL
(
pt_priv
,
priv
,
PT_PRIV_MAGIC
);
AZ
(
strcmp
(
vpt
->
desc
->
ctype
,
"uint64_t"
));
bprintf
(
buf
,
"%s.%s.%s"
,
vpt
->
section
->
type
,
vpt
->
section
->
ident
,
vpt
->
desc
->
name
);
bprintf
(
buf
,
"%s.%s"
,
vpt
->
section
->
ident
,
vpt
->
desc
->
name
);
if
(
!
strcmp
(
buf
,
"MGT..uptime"
))
mgt_uptime
=
vpt
->
ptr
;
...
...
@@ -313,12 +312,7 @@ build_pt_list_cb(void *priv, const struct VSC_point *vpt)
pt
->
key
=
strdup
(
buf
);
AN
(
pt
->
key
);
if
(
*
vpt
->
section
->
type
!=
'\0'
)
bprintf
(
buf
,
"%s.%s"
,
vpt
->
section
->
type
,
vpt
->
desc
->
name
);
else
if
(
*
vpt
->
section
->
ident
!=
'\0'
)
bprintf
(
buf
,
"%s.%s"
,
vpt
->
section
->
ident
,
vpt
->
desc
->
name
);
else
bprintf
(
buf
,
"%s"
,
vpt
->
desc
->
name
);
bprintf
(
buf
,
"%s.%s"
,
vpt
->
section
->
ident
,
vpt
->
desc
->
name
);
REPLACE
(
pt
->
name
,
buf
);
AN
(
pt
->
name
);
...
...
bin/varnishtest/tests/u00005.vtc
View file @
a93c4555
...
...
@@ -45,7 +45,7 @@ shell -err -expect "Cannot open /nonexistent/_.vsm" \
"varnishstat -n /nonexistent -t 1"
shell -expect "MAIN.uptime" \
"varnishstat -n ${v1_name} -1"
shell -expect "<
type>MAIN</typ
e>" \
shell -expect "<
name>MAIN.uptime</nam
e>" \
"varnishstat -n ${v1_name} -x"
shell -match {"MAIN.uptime":} \
"varnishstat -n ${v1_name} -j"
bin/varnishtest/vtc_varnish.c
View file @
a93c4555
...
...
@@ -822,11 +822,7 @@ do_stat_dump_cb(void *priv, const struct VSC_point * const pt)
return
(
0
);
u
=
*
(
const
volatile
uint64_t
*
)
pt
->
ptr
;
strcpy
(
buf
,
pt
->
section
->
type
);
if
(
pt
->
section
->
ident
[
0
]
!=
'\0'
)
bprintf
(
buf
,
"%s.%s"
,
pt
->
section
->
ident
,
pt
->
desc
->
name
);
else
bprintf
(
buf
,
"MAIN.%s"
,
pt
->
desc
->
name
);
bprintf
(
buf
,
"%s.%s"
,
pt
->
section
->
ident
,
pt
->
desc
->
name
);
if
(
strcmp
(
dp
->
arg
,
"*"
))
{
if
(
fnmatch
(
dp
->
arg
,
buf
,
0
))
...
...
@@ -858,7 +854,6 @@ varnish_vsc(const struct varnish *v, const char *arg)
*/
struct
stat_priv
{
char
target_type
[
256
];
char
target_ident
[
256
];
char
target_name
[
256
];
uintmax_t
val
;
...
...
@@ -873,8 +868,6 @@ do_stat_cb(void *priv, const struct VSC_point * const pt)
if
(
pt
==
NULL
)
return
(
0
);
if
(
strcmp
(
pt
->
section
->
type
,
sp
->
target_type
))
return
(
0
);
if
(
strcmp
(
pt
->
section
->
ident
,
sp
->
target_ident
))
return
(
0
);
if
(
strcmp
(
pt
->
desc
->
name
,
sp
->
target_name
))
...
...
@@ -895,7 +888,6 @@ varnish_expect(const struct varnish *v, char * const *av)
int
good
;
char
*
r
;
char
*
p
;
char
*
q
;
int
i
,
not
=
0
;
struct
stat_priv
sp
;
...
...
@@ -908,22 +900,13 @@ varnish_expect(const struct varnish *v, char * const *av)
AN
(
av
[
1
]);
AN
(
av
[
2
]);
}
p
=
strchr
(
r
,
'.'
);
p
=
str
r
chr
(
r
,
'.'
);
if
(
p
==
NULL
)
{
strcpy
(
sp
.
target_type
,
"MAIN"
);
sp
.
target_ident
[
0
]
=
'\0'
;
strcpy
(
sp
.
target_ident
,
"MAIN"
);
bprintf
(
sp
.
target_name
,
"%s"
,
r
);
}
else
{
bprintf
(
sp
.
target_type
,
"%.*s"
,
(
int
)(
p
-
r
),
r
);
p
++
;
q
=
strrchr
(
p
,
'.'
);
if
(
q
==
NULL
)
{
sp
.
target_ident
[
0
]
=
'\0'
;
bprintf
(
sp
.
target_name
,
"%s"
,
p
);
}
else
{
bprintf
(
sp
.
target_ident
,
"%.*s"
,
(
int
)(
q
-
p
),
p
);
bprintf
(
sp
.
target_name
,
"%s"
,
q
+
1
);
}
bprintf
(
sp
.
target_ident
,
"%.*s"
,
(
int
)(
p
-
r
),
r
);
bprintf
(
sp
.
target_name
,
"%s"
,
p
+
1
);
}
sp
.
val
=
0
;
...
...
include/vapi/vsc.h
View file @
a93c4555
...
...
@@ -85,7 +85,6 @@ struct VSC_level_desc {
};
struct
VSC_section
{
char
*
type
;
char
*
ident
;
};
...
...
lib/libvarnishapi/vsc.c
View file @
a93c4555
...
...
@@ -249,12 +249,19 @@ static struct vsc_vf *
vsc_add_vf
(
struct
vsc
*
vsc
,
const
struct
VSM_fantom
*
fantom
,
int
order
)
{
struct
vsc_vf
*
vf
,
*
vf2
;
struct
vsb
*
vsb
;
ALLOC_OBJ
(
vf
,
VSC_VF_MAGIC
);
AN
(
vf
);
vf
->
fantom
=
*
fantom
;
REPLACE
(
vf
->
section
.
type
,
vf
->
fantom
.
type
);
REPLACE
(
vf
->
section
.
ident
,
vf
->
fantom
.
ident
);
vsb
=
VSB_new_auto
();
AN
(
vsb
);
VSB_printf
(
vsb
,
"%s"
,
vf
->
fantom
.
type
);
if
(
*
vf
->
fantom
.
ident
!=
'\0'
)
VSB_printf
(
vsb
,
".%s"
,
vf
->
fantom
.
ident
);
AZ
(
VSB_finish
(
vsb
));
REPLACE
(
vf
->
section
.
ident
,
VSB_data
(
vsb
));
VSB_destroy
(
&
vsb
);
vf
->
order
=
order
;
VTAILQ_FOREACH
(
vf2
,
&
vsc
->
vf_list
,
list
)
{
...
...
@@ -355,7 +362,38 @@ vsc_build_pt_list(struct VSM_data *vd)
DOF
(
sdesc
,
"oneliner"
);
DOF
(
ldesc
,
"docs"
);
#undef DOF
vt
=
vjsn_child
(
vv
,
"type"
);
AN
(
vt
);
assert
(
vt
->
type
==
VJSN_STRING
);
if
(
!
strcmp
(
vt
->
value
,
"counter"
))
{
vdsc
->
semantics
=
'c'
;
}
else
if
(
!
strcmp
(
vt
->
value
,
"gauge"
))
{
vdsc
->
semantics
=
'g'
;
}
else
if
(
!
strcmp
(
vt
->
value
,
"bitmap"
))
{
vdsc
->
semantics
=
'b'
;
}
else
{
vdsc
->
semantics
=
'?'
;
}
vt
=
vjsn_child
(
vv
,
"format"
);
AN
(
vt
);
assert
(
vt
->
type
==
VJSN_STRING
);
if
(
!
strcmp
(
vt
->
value
,
"integer"
))
{
vdsc
->
format
=
'i'
;
}
else
if
(
!
strcmp
(
vt
->
value
,
"bytes"
))
{
vdsc
->
format
=
'B'
;
}
else
if
(
!
strcmp
(
vt
->
value
,
"bitmap"
))
{
vdsc
->
format
=
'b'
;
}
else
if
(
!
strcmp
(
vt
->
value
,
"duration"
))
{
vdsc
->
format
=
'd'
;
}
else
{
vdsc
->
format
=
'?'
;
}
vdsc
->
level
=
&
level_info
;
vt
=
vjsn_child
(
vv
,
"index"
);
AN
(
vt
);
vsc_add_pt
(
vsc
,
...
...
@@ -373,8 +411,6 @@ vsc_filter_match_pt(struct vsb *vsb, const struct vsc_sf *sf, const
struct
vsc_pt
*
pt
)
{
VSB_clear
(
vsb
);
if
(
strcmp
(
pt
->
point
.
section
->
type
,
""
))
VSB_printf
(
vsb
,
"%s."
,
pt
->
point
.
section
->
type
);
if
(
strcmp
(
pt
->
point
.
section
->
ident
,
""
))
VSB_printf
(
vsb
,
"%s."
,
pt
->
point
.
section
->
ident
);
VSB_printf
(
vsb
,
"%s"
,
pt
->
point
.
desc
->
name
);
...
...
lib/libvcc/vsctool.py
View file @
a93c4555
...
...
@@ -43,12 +43,14 @@ import collections
TYPES
=
[
"counter"
,
"gauge"
,
"bitmap"
]
CTYPES
=
[
"uint64_t"
]
LEVELS
=
[
"info"
,
"diag"
,
"debug"
]
FORMATS
=
[
"integer"
,
"bytes"
,
"duration"
]
PARAMS
=
{
"type"
:
[
"counter"
,
TYPES
],
"ctype"
:
[
"uint64_t"
,
CTYPES
],
"level"
:
[
"info"
,
LEVELS
],
"oneliner"
:
True
,
"format"
:
[
"integer"
,
FORMATS
],
}
def
gzip_str
(
s
):
...
...
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