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

Method Flush

lib/perfdata/elasticsearchwriter.cpp:434–452  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

432}
433
434void ElasticsearchWriter::Flush()
435{
436 /* Flush can be called from 1) Timeout 2) Threshold 3) on shutdown/reload. */
437 if (m_DataBuffer.empty())
438 return;
439
440 /* Ensure you hold a lock against m_DataBuffer so that things
441 * don't go missing after creating the body and clearing the buffer.
442 */
443 String body = boost::algorithm::join(m_DataBuffer, "\n");
444 m_DataBuffer.clear();
445
446 /* Elasticsearch 6.x requires a new line. This is compatible to 5.x.
447 * Tested with 6.0.0 and 5.6.4.
448 */
449 body += "\n";
450
451 SendRequest(body);
452}
453
454void ElasticsearchWriter::SendRequest(const String& body)
455{

Callers

nothing calls this directly

Calls 2

emptyMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected