Skip to content

Commit

Permalink
[metrics] Also flush DeltaProducer on ExportNow
Browse files Browse the repository at this point in the history
The internal delta producer needs to be flushed, otherwise you might see stale metrics exported on ExportNow().
  • Loading branch information
ericl committed Sep 28, 2022
1 parent 92c2d75 commit 367d732
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion thirdparty/patches/opencensus-cpp-shutdown-api.patch
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ diff --git opencensus/stats/internal/stats_exporter.cc opencensus/stats/internal
index 43ddbc7..37b4ae1 100644
--- opencensus/stats/internal/stats_exporter.cc
+++ opencensus/stats/internal/stats_exporter.cc
@@ -95,25 +95,56 @@ void StatsExporterImpl::ClearHandlersForTesting() {
@@ -95,25 +95,57 @@ void StatsExporterImpl::ClearHandlersForTesting() {
}

void StatsExporterImpl::StartExportThread() EXCLUSIVE_LOCKS_REQUIRED(mu_) {
Expand Down Expand Up @@ -140,6 +140,7 @@ index 43ddbc7..37b4ae1 100644
+}
+
+void StatsExporter::ExportNow() {
+ DeltaProducer::Get()->Flush();
+ StatsExporterImpl::Get()->Export();
+}
+
Expand Down

0 comments on commit 367d732

Please sign in to comment.