1 | # Licensed to the StackStorm, Inc ('StackStorm') under one or more |
||
2 | # contributor license agreements. See the NOTICE file distributed with |
||
3 | # this work for additional information regarding copyright ownership. |
||
4 | # The ASF licenses this file to You under the Apache License, Version 2.0 |
||
5 | # (the "License"); you may not use this file except in compliance with |
||
6 | # the License. You may obtain a copy of the License at |
||
7 | # |
||
8 | # http://www.apache.org/licenses/LICENSE-2.0 |
||
9 | # |
||
10 | # Unless required by applicable law or agreed to in writing, software |
||
11 | # distributed under the License is distributed on an "AS IS" BASIS, |
||
12 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
||
13 | # See the License for the specific language governing permissions and |
||
14 | # limitations under the License. |
||
15 | |||
16 | from st2common import log as logging |
||
17 | from st2common.metrics.base import BaseMetricsDriver |
||
18 | |||
19 | __all__ = [ |
||
20 | 'EchoDriver' |
||
21 | ] |
||
22 | |||
23 | LOG = logging.getLogger(__name__) |
||
24 | |||
25 | |||
26 | class EchoDriver(BaseMetricsDriver): |
||
27 | """ |
||
28 | Driver which logs / LOG.debugs out each metrics operation which would have been performed. |
||
29 | """ |
||
30 | |||
31 | def time(self, key, time): |
||
32 | LOG.debug('[metrics] time(key=%s, time=%s)' % (key, time)) |
||
0 ignored issues
–
show
Coding Style
Best Practice
introduced
by
Loading history...
|
|||
33 | |||
34 | def inc_counter(self, key, amount=1): |
||
35 | LOG.debug('[metrics] counter.incr(%s, %s)' % (key, amount)) |
||
0 ignored issues
–
show
|
|||
36 | |||
37 | def dec_counter(self, key, amount=1): |
||
38 | LOG.debug('[metrics] counter.decr(%s, %s)' % (key, amount)) |
||
0 ignored issues
–
show
|
|||
39 | |||
40 | def set_gauge(self, key, value): |
||
41 | LOG.debug('[metrics] set_gauge(%s, %s)' % (key, value)) |
||
0 ignored issues
–
show
|
|||
42 | |||
43 | def inc_gauge(self, key, amount=1): |
||
44 | LOG.debug('[metrics] gauge.incr(%s, %s)' % (key, amount)) |
||
0 ignored issues
–
show
|
|||
45 | |||
46 | def dec_gauge(self, key, amount=1): |
||
47 | LOG.debug('[metrics] gauge.decr(%s, %s)' % (key, amount)) |
||
0 ignored issues
–
show
|
|||
48 |