Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
Grpc
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
tci-gateway-module
Grpc
Commits
d3918fd8
Commit
d3918fd8
authored
8 years ago
by
kpayson64
Committed by
GitHub
8 years ago
Browse files
Options
Downloads
Plain Diff
Merge pull request #7100 from sreecha/stress_test_metrics_fix
Stress tests: Fix metrics-client logging
parents
98b24414
9181754c
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/cpp/interop/metrics_client.cc
+13
-14
13 additions, 14 deletions
test/cpp/interop/metrics_client.cc
with
13 additions
and
14 deletions
test/cpp/interop/metrics_client.cc
+
13
−
14
View file @
d3918fd8
...
...
@@ -56,6 +56,9 @@ using grpc::testing::GaugeResponse;
using
grpc
::
testing
::
MetricsService
;
using
grpc
::
testing
::
MetricsServiceImpl
;
// Do not log anything
void
BlackholeLogger
(
gpr_log_func_args
*
args
)
{}
// Prints the values of all Gauges (unless total_only is set to 'true' in which
// case this only prints the sum of all gauge values).
bool
PrintMetrics
(
std
::
unique_ptr
<
MetricsService
::
Stub
>
stub
,
bool
total_only
,
...
...
@@ -76,21 +79,21 @@ bool PrintMetrics(std::unique_ptr<MetricsService::Stub> stub, bool total_only,
while
(
reader
->
Read
(
&
gauge_response
))
{
if
(
gauge_response
.
value_case
()
==
GaugeResponse
::
kLongValue
)
{
if
(
!
total_only
)
{
gpr_log
(
GPR_INFO
,
"%s: %lld"
,
gauge_response
.
name
()
.
c_str
(),
gauge_response
.
long_value
()
)
;
std
::
cout
<<
gauge_response
.
name
()
<<
": "
<<
gauge_response
.
long_value
()
<<
std
::
endl
;
}
overall_qps
+=
gauge_response
.
long_value
();
}
else
{
gpr_log
(
GPR_INFO
,
"Gauge %s
is not
a
long value"
,
gauge_response
.
name
().
c_str
())
;
std
::
cout
<<
"Gauge '"
<<
gauge_response
.
name
()
<<
"'
is not long value
d
"
<<
std
::
endl
;
}
}
gpr_log
(
GPR_INFO
,
"%ld"
,
overall_qps
)
;
std
::
cout
<<
overall_qps
<<
std
::
endl
;
const
grpc
::
Status
status
=
reader
->
Finish
();
if
(
!
status
.
ok
())
{
gpr_log
(
GPR_ERROR
,
"Error in getting metrics from the client"
)
;
std
::
cout
<<
"Error in getting metrics from the client"
<<
std
::
endl
;
}
return
status
.
ok
();
...
...
@@ -99,14 +102,10 @@ bool PrintMetrics(std::unique_ptr<MetricsService::Stub> stub, bool total_only,
int
main
(
int
argc
,
char
**
argv
)
{
grpc
::
testing
::
InitTest
(
&
argc
,
&
argv
,
true
);
// Make sure server_addresses flag is not empty
if
(
FLAGS_metrics_server_address
.
empty
())
{
gpr_log
(
GPR_ERROR
,
"Cannot connect to the Metrics server. Please pass the address of the"
"metrics server to connect to via the 'metrics_server_address' flag"
);
return
1
;
}
// The output of metrics client is in some cases programatically parsed (for
// example by the stress test framework). So, we do not want any of the log
// from the grpc library appearing on stdout.
gpr_set_log_function
(
BlackholeLogger
);
std
::
shared_ptr
<
grpc
::
Channel
>
channel
(
grpc
::
CreateChannel
(
FLAGS_metrics_server_address
,
grpc
::
InsecureChannelCredentials
()));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment