Browse Source

end spans before thread waits

also removed some spans from the networks/members db watcher.  Those will be 5 seconds long no matter what, and the underlying processes already have their own spans
Grant Limberg 3 weeks ago
parent
commit
7934fef84c
1 changed files with 3 additions and 10 deletions
  1. 3 10
      controller/CV2.cpp

+ 3 - 10
controller/CV2.cpp

@@ -776,6 +776,7 @@ void CV2::heartbeat()
 		}
 		}
 
 
 		_pool->unborrow(c);
 		_pool->unborrow(c);
+		span->End();
 
 
 		std::this_thread::sleep_for(std::chrono::seconds(1));
 		std::this_thread::sleep_for(std::chrono::seconds(1));
 	}
 	}
@@ -792,11 +793,6 @@ void CV2::membersDbWatcher()
 	MemberNotificationReceiver m(this, *c->c, stream);
 	MemberNotificationReceiver m(this, *c->c, stream);
 
 
 	while (_run == 1) {
 	while (_run == 1) {
-		auto provider = opentelemetry::trace::Provider::GetTracerProvider();
-		auto tracer = provider->GetTracer("cv2");
-		auto span = tracer->StartSpan("cv2::membersDbWatcher");
-		auto scope = tracer->WithActiveSpan(span);
-
 		c->c->await_notification(5, 0);
 		c->c->await_notification(5, 0);
 	}
 	}
 
 
@@ -816,11 +812,6 @@ void CV2::networksDbWatcher()
 	NetworkNotificationReceiver n(this, *c->c, stream);
 	NetworkNotificationReceiver n(this, *c->c, stream);
 
 
 	while (_run == 1) {
 	while (_run == 1) {
-		auto provider = opentelemetry::trace::Provider::GetTracerProvider();
-		auto tracer = provider->GetTracer("cv2");
-		auto span = tracer->StartSpan("cv2::networksDbWatcher");
-		auto scope = tracer->WithActiveSpan(span);
-
 		c->c->await_notification(5, 0);
 		c->c->await_notification(5, 0);
 	}
 	}
 
 
@@ -1214,6 +1205,8 @@ void CV2::onlineNotificationThread()
 		}
 		}
 		_pool->unborrow(c2);
 		_pool->unborrow(c2);
 		_pool->unborrow(c);
 		_pool->unborrow(c);
+		span->End();
+
 		std::this_thread::sleep_for(std::chrono::seconds(10));
 		std::this_thread::sleep_for(std::chrono::seconds(10));
 	}
 	}