File tree Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Filter options
Expand file tree Collapse file tree 1 file changed +7
-10
lines changed
Original file line number Diff line number Diff line change 12
12
# See the License for the specific language governing permissions and
13
13
# limitations under the License.
14
14
15
+ # [START monitoring_opencensus_metrics_quickstart]
16
+
15
17
import time
16
18
import random
17
19
23
25
24
26
from opencensus .stats .exporters import stackdriver_exporter
25
27
26
-
28
+ # [START setup_exporter]
27
29
# Set up the metric to be tracked
28
30
29
31
# Latency of two kinds of simulated operations, "normal" and "extra"
45
47
latency_distribution
46
48
)
47
49
48
-
49
50
# Initialization
51
+
50
52
statistics = stats .Stats ()
51
53
52
54
view_manager = statistics .view_manager
57
59
58
60
view_manager .register_exporter (exporter )
59
61
view_manager .register_view (latency_view )
60
-
61
- # [START monitoring_opencensus_metrics_quickstart]
62
-
63
- # [START setup_exporter]
64
-
65
62
# [END setup_exporter]
66
63
67
- # [END monitoring_opencensus_metrics_quickstart]
68
-
69
64
70
65
def process (kind ):
71
66
sleep_time = random .random () ** 2 # More interesting than just linear
@@ -95,7 +90,9 @@ def main(iteration_count):
95
90
measure_map .measure_float_put (latency_measure , duration )
96
91
tag_map = opencensus .tags .TagMap ()
97
92
tag_map .insert (latency_key , opencensus .tags .tag_value .TagValue (kind ))
98
- measure_map .record (tag_map )
93
+
94
+ measure_map .record (tag_map )
95
+ # [END monitoring_opencensus_metrics_quickstart]
99
96
100
97
101
98
if __name__ == '__main__' :
You can’t perform that action at this time.
0 commit comments