MCPcopy Create free account
hub / github.com/Icinga/icinga2 / Export

Method Export

lib/otel/otel.cpp:154–174  ·  view source on GitHub ↗

* Export the given OTel metrics request to the OpenTelemetry backend. * * This method initiates the export of the provided OTel metrics request to the configured * OpenTelemetry backend. If an export is already in progress, it waits for the previous * export to complete before proceeding with the new export request (blocking the caller). * * @param request The OTel metrics request to export.

Source from the content-addressed store, hash-verified

152 * @param request The OTel metrics request to export.
153 */
154void OTel::Export(std::unique_ptr<MetricsRequest>&& request)
155{
156 std::unique_lock lock(m_Mutex);
157 if (m_Exporting) {
158 Log(LogWarning, "OTelExporter")
159 << "Received export request while previous export is still in progress. Waiting for it to complete.";
160
161 m_ExportCV.wait(lock, [this] { return m_Stopped || !m_Exporting; });
162 if (m_Stopped) {
163 return;
164 }
165 }
166 m_Exporting = true;
167 lock.unlock();
168
169 // Access to m_Request is serialized via m_Strand, so we must post the actual export operation to it.
170 boost::asio::post(m_Strand, [this, keepAlive = ConstPtr(this), request = std::move(request)]() mutable {
171 m_Request = std::move(request);
172 m_ExportAsioCV.NotifyAll();
173 });
174}
175
176/**
177 * Populate the standard OTel resource attributes in the given ResourceMetrics Protobuf object.

Callers 1

FlushMethod · 0.80

Calls 2

LogClass · 0.85
NotifyAllMethod · 0.80

Tested by

no test coverage detected