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
39181b71
Commit
39181b71
authored
Jul 23, 2016
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Let varnishhist see the backend side and add some profiles ...
... for the standard backend timestamps and size.
parent
149b6287
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
86 additions
and
20 deletions
+86
-20
varnishhist.c
bin/varnishhist/varnishhist.c
+75
-14
varnishhist_options.h
bin/varnishhist/varnishhist_options.h
+11
-6
No files found.
bin/varnishhist/varnishhist.c
View file @
39181b71
...
...
@@ -105,6 +105,7 @@ static int scales[] = {
struct
profile
{
const
char
*
name
;
char
VSL_arg
;
enum
VSL_tag_e
tag
;
const
char
*
prefix
;
int
field
;
...
...
@@ -112,22 +113,64 @@ struct profile {
int
hist_high
;
}
profiles
[]
=
{
// client
{
.
name
=
"responsetime"
,
.
VSL_arg
=
'c'
,
.
tag
=
SLT_Timestamp
,
.
prefix
=
"Process:"
,
.
field
=
3
,
.
hist_low
=
-
6
,
.
hist_high
=
3
},
{
},
{
.
name
=
"size"
,
.
VSL_arg
=
'c'
,
.
tag
=
SLT_ReqAcct
,
.
prefix
=
NULL
,
.
field
=
5
,
.
hist_low
=
1
,
.
hist_high
=
8
},
{
.
name
=
0
,
},
// backend
{
.
name
=
"Bereqtime"
,
.
VSL_arg
=
'b'
,
.
tag
=
SLT_Timestamp
,
.
prefix
=
"Bereq:"
,
.
field
=
3
,
.
hist_low
=
-
6
,
.
hist_high
=
3
},
{
.
name
=
"Beresptime"
,
.
VSL_arg
=
'b'
,
.
tag
=
SLT_Timestamp
,
.
prefix
=
"Beresp:"
,
.
field
=
3
,
.
hist_low
=
-
6
,
.
hist_high
=
3
},
{
.
name
=
"BerespBodytime"
,
.
VSL_arg
=
'b'
,
.
tag
=
SLT_Timestamp
,
.
prefix
=
"BerespBody:"
,
.
field
=
3
,
.
hist_low
=
-
6
,
.
hist_high
=
3
},
{
.
name
=
"Besize"
,
.
VSL_arg
=
'b'
,
.
tag
=
SLT_BereqAcct
,
.
prefix
=
NULL
,
.
field
=
5
,
.
hist_low
=
1
,
.
hist_high
=
8
},
{
.
name
=
NULL
}
};
...
...
@@ -203,9 +246,6 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
(
void
)
priv
;
for
(
tr
=
pt
[
0
];
tr
!=
NULL
;
tr
=
*++
pt
)
{
if
(
tr
->
type
!=
VSL_t_req
)
/* Only look at client requests */
continue
;
if
(
tr
->
reason
==
VSL_r_esi
)
/* Skip ESI requests */
continue
;
...
...
@@ -223,7 +263,9 @@ accumulate(struct VSL_data *vsl, struct VSL_transaction * const pt[],
break
;
case
SLT_VCL_return
:
if
(
!
strcasecmp
(
VSL_CDATA
(
tr
->
c
->
rec
.
ptr
),
"restart"
))
"restart"
)
||
!
strcasecmp
(
VSL_CDATA
(
tr
->
c
->
rec
.
ptr
),
"retry"
))
skip
=
1
;
break
;
default
:
...
...
@@ -374,11 +416,19 @@ usage(int status)
exit
(
status
);
}
static
void
profile_error
(
const
char
*
s
)
{
fprintf
(
stderr
,
"-P: '%s' is not a valid"
" profile name or definition
\n
"
,
s
);
exit
(
1
);
}
int
main
(
int
argc
,
char
**
argv
)
{
int
i
;
c
har
*
colon
;
c
onst
char
*
colon
,
*
ptag
;
const
char
*
profile
=
"responsetime"
;
pthread_t
thr
;
int
fnum
=
-
1
;
...
...
@@ -387,8 +437,6 @@ main(int argc, char **argv)
VUT_Init
(
progname
,
argc
,
argv
,
&
vopt_spec
);
/* only client requests */
assert
(
VUT_Arg
(
'c'
,
NULL
));
while
((
i
=
getopt
(
argc
,
argv
,
vopt_spec
.
vopt_optstring
))
!=
-
1
)
{
switch
(
i
)
{
case
'h'
:
...
...
@@ -402,14 +450,25 @@ main(int argc, char **argv)
break
;
}
/* else it's a definition, we hope */
if
(
colon
==
optarg
+
1
&&
(
*
optarg
==
'b'
||
*
optarg
==
'c'
))
{
cli_p
.
VSL_arg
=
*
optarg
;
ptag
=
colon
+
1
;
colon
=
strchr
(
colon
+
1
,
':'
);
if
(
colon
==
NULL
)
profile_error
(
optarg
);
}
else
{
ptag
=
optarg
;
cli_p
.
VSL_arg
=
'c'
;
}
assert
(
colon
);
if
(
sscanf
(
colon
+
1
,
"%d:%d:%d"
,
&
cli_p
.
field
,
&
cli_p
.
hist_low
,
&
cli_p
.
hist_high
)
!=
3
)
{
fprintf
(
stderr
,
"-P: '%s' is not a valid"
" profile name or definition
\n
"
,
optarg
);
exit
(
1
);
profile_error
(
optarg
);
}
match_tag
=
VSL_Name2Tag
(
optarg
,
colon
-
optar
g
);
match_tag
=
VSL_Name2Tag
(
ptag
,
colon
-
pta
g
);
if
(
match_tag
<
0
)
{
fprintf
(
stderr
,
"-P: '%s' is not a valid tag name
\n
"
,
...
...
@@ -450,6 +509,8 @@ main(int argc, char **argv)
fprintf
(
stderr
,
"-P: No such profile '%s'
\n
"
,
profile
);
exit
(
1
);
}
assert
(
VUT_Arg
(
active_profile
->
VSL_arg
,
NULL
));
match_tag
=
active_profile
->
tag
;
fnum
=
active_profile
->
field
;
hist_low
=
active_profile
->
hist_low
;
...
...
bin/varnishhist/varnishhist_options.h
View file @
39181b71
...
...
@@ -45,13 +45,18 @@
)
#define HIS_OPT_P \
VOPT("P:", "[-P <
size|responsetime|
tag:field_num:min:max>]", \
VOPT("P:", "[-P <
profile|[[cb:]
tag:field_num:min:max>]", \
"Profile definition", \
"Either specify \"size\" or \"responsetime\" profile or" \
" create a new one. Define the tag we'll look for, and the" \
" field number of the value we are interested in. min and" \
" max are the boundaries of the graph (these are power of" \
" tens)." \
"Either a predefined profile or a custom definition. " \
" Predefined profiles for the client side are" \
" \"responsetime \" and \"size\". For the backend side:" \
" \"Bereqtime\", \"Beresptime\", \"BerespBodytime\"," \
" and \"Besize\"." \
" custom definitions include an optional (c)lient or" \
" (b)backend filter (defaults to client), the tag we'll" \
" look for, and the field number of the value we are" \
" interested in. min and max are the boundaries of the" \
" graph (these are power of ten)." \
)
VSL_OPT_C
...
...
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