Skip to content

Commit df1cb21

Browse files
committed
Sending data, but not right yet
1 parent ca4b974 commit df1cb21

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

opencensus/quickstart/quickstart.py

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,15 @@
2121
from opencensus.stats import measure
2222
from opencensus.stats import stats
2323
from opencensus.stats import view
24-
import opencensus.tags
24+
#import opencensus.tags
2525

2626
from opencensus.stats.exporters import stackdriver_exporter
2727

2828
# [START setup_exporter]
2929
# Set up the metric to be tracked
3030

3131
# Latency of two kinds of simulated operations, "normal" and "extra"
32-
latency_key = opencensus.tags.tag_key.TagKey('kind')
32+
#latency_key = opencensus.tags.tag_key.TagKey('kind')
3333

3434
# Measure in milliseconds
3535
latency_measure = measure.MeasureFloat('latency', 'Latency in ms', 'ms')
@@ -42,7 +42,8 @@
4242
latency_view = view.View(
4343
'latency',
4444
'Processing time',
45-
[latency_key],
45+
# [latency_key],
46+
[],
4647
latency_measure,
4748
latency_distribution
4849
)
@@ -70,6 +71,8 @@ def process(kind):
7071

7172

7273
def main(iteration_count):
74+
measure_map = recorder.new_measurement_map()
75+
#tag_map = opencensus.tags.TagMap()
7376

7477
# Simulated processing normally takes up to 1000 ms, randomly distributed.
7578
# Ten percent of the time, simulated "extra" processing adds 500ms
@@ -86,13 +89,11 @@ def main(iteration_count):
8689
duration = time.time() - start_time
8790

8891
# Record the measurement
89-
measure_map = recorder.new_measurement_map()
9092
measure_map.measure_float_put(latency_measure, duration)
91-
tag_map = opencensus.tags.TagMap()
92-
tag_map.insert(latency_key, opencensus.tags.tag_value.TagValue(kind))
93+
#tag_map.insert(latency_key, opencensus.tags.tag_value.TagValue(kind))
9394
print(duration)
9495

95-
measure_map.record(tag_map)
96+
measure_map.record()
9697
time.sleep(60)
9798
# [END monitoring_opencensus_metrics_quickstart]
9899

0 commit comments

Comments
 (0)