This repository was archived by the owner on Jul 31, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 3 files changed +3
-30
lines changed
opencensus/trace/internal Expand file tree Collapse file tree 3 files changed +3
-30
lines changed Original file line number Diff line number Diff line change 2222namespace opencensus {
2323namespace trace {
2424
25- class SpanTestPeer {
26- public:
27- static void End (absl::Duration latency, Span* span) {
28- // Set latency.
29- span->span_impl_for_test ()->EndWithLatencyForTesting (latency);
30- // Call Span::ExportSpanForTesting to get span into stores.
31- span->span_impl_for_test ()->ExportSpanForTesting (
32- span->span_impl_for_test ());
33- }
34- };
35-
3625namespace exporter {
3726class LocalSpanStoreImplTestPeer {
3827 public:
@@ -48,16 +37,14 @@ TEST(LocalSpanStoreTest, GetSummary) {
4837 auto span = Span::StartSpan (" SpanName" , /* parent=*/ nullptr ,
4938 {nullptr , /* record_events=*/ true });
5039 span.AddAnnotation (" Annotation" );
51- SpanTestPeer:: End (absl::Microseconds ( 15 ), &span );
40+ span. End ();
5241
5342 auto summary = LocalSpanStore::GetSummary ();
5443 EXPECT_EQ (1 , summary.per_span_name_summary .size ());
5544 EXPECT_EQ (1 , summary.per_span_name_summary [" SpanName" ]
5645 .number_of_latency_sampled_spans .size ());
57- EXPECT_EQ (
58- 1 ,
59- summary.per_span_name_summary [" SpanName" ].number_of_latency_sampled_spans
60- [LocalSpanStore::LatencyBucketBoundary::k10us_to_100us]);
46+ // TODO: EXPECT it ended up in the right bucket in
47+ // number_of_latency_sampled_spans[].
6148}
6249
6350} // namespace
Original file line number Diff line number Diff line change @@ -137,25 +137,13 @@ void SpanImpl::SetStatus(exporter::Status&& status) {
137137 }
138138}
139139
140- void SpanImpl::ExportSpanForTesting (const std::shared_ptr<SpanImpl>& span) {
141- exporter::RunningSpanStoreImpl::Get ()->RemoveSpan (span);
142- exporter::LocalSpanStoreImpl::Get ()->AddSpan (span);
143- exporter::SpanExporterImpl::Get ()->AddSpan (span);
144- }
145-
146140void SpanImpl::End () { EndWithTime (absl::Now ()); }
147141
148142bool SpanImpl::HasEnded () const {
149143 absl::MutexLock l (&mu_);
150144 return has_ended_;
151145}
152146
153- void SpanImpl::EndWithLatencyForTesting (absl::Duration latency) {
154- absl::MutexLock l (&mu_);
155- has_ended_ = true ;
156- end_time_ = start_time_ + latency;
157- }
158-
159147void SpanImpl::EndWithTime (absl::Time end_time) {
160148 absl::MutexLock l (&mu_);
161149 if (!has_ended_) {
Original file line number Diff line number Diff line change @@ -106,8 +106,6 @@ class SpanImpl final {
106106 friend class ::opencensus::trace::exporter::SpanExporterImpl;
107107 friend class ::opencensus::trace::SpanTestPeer;
108108
109- void ExportSpanForTesting (const std::shared_ptr<SpanImpl>& span);
110- void EndWithLatencyForTesting (absl::Duration latency) LOCKS_EXCLUDED(mu_);
111109 void EndWithTime (absl::Time end_time) LOCKS_EXCLUDED(mu_);
112110
113111 // Makes a deep copy of span contents and returns copied data in SpanData.
You can’t perform that action at this time.
0 commit comments