]> git.ipfire.org Git - thirdparty/collectd.git/commitdiff
open_telemetry plugin: Move prototypes to a header file. 4271/head
authorFlorian Forster <octo@collectd.org>
Tue, 20 Feb 2024 14:17:53 +0000 (15:17 +0100)
committerFlorian Forster <octo@collectd.org>
Tue, 20 Feb 2024 14:32:42 +0000 (15:32 +0100)
Makefile.am
src/open_telemetry.cc
src/open_telemetry.h [new file with mode: 0644]
src/open_telemetry_exporter.cc
src/open_telemetry_receiver.cc

index dbc9b1c0a7d5929362db6ed22e8deabad47d5081..3a13c3042d7e802eb4b229c4cc318fa0db00dfa5 100644 (file)
@@ -1747,7 +1747,7 @@ endif
 if BUILD_PLUGIN_OPEN_TELEMETRY
 pkglib_LTLIBRARIES += open_telemetry.la
 open_telemetry_la_SOURCES = \
-       src/open_telemetry.cc \
+       src/open_telemetry.cc src/open_telemetry.h \
        src/open_telemetry_exporter.cc \
        src/open_telemetry_receiver.cc \
        opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.cc \
index f87ea920307b766bd519827b1727677c72561a9f..10aa2510f132740bed0b8128e14707fe4300e929 100644 (file)
@@ -31,8 +31,7 @@ extern "C" {
 #include "daemon/plugin.h"
 }
 
-int exporter_config(oconfig_item_t *ci);
-int receiver_config(oconfig_item_t *ci);
+#include "open_telemetry.h"
 
 static int ot_config(oconfig_item_t *ci) {
   for (int i = 0; i < ci->children_num; i++) {
diff --git a/src/open_telemetry.h b/src/open_telemetry.h
new file mode 100644 (file)
index 0000000..2b332d9
--- /dev/null
@@ -0,0 +1,42 @@
+/**
+ * collectd - src/open_telemetry.h
+ * Copyright (C) 2024       Florian octo Forster
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a
+ * copy of this software and associated documentation files (the "Software"),
+ * to deal in the Software without restriction, including without limitation
+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,
+ * and/or sell copies of the Software, and to permit persons to whom the
+ * Software is furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+ * DEALINGS IN THE SOFTWARE.
+ *
+ * Authors:
+ *   Florian octo Forster <octo at collectd.org>
+ **/
+
+#ifndef OPEN_TELEMETRY_H
+#define OPEN_TELEMETRY_H 1
+
+extern "C" {
+#include "daemon/collectd.h"
+#include "daemon/configfile.h"
+}
+
+#include <grpc++/grpc++.h>
+
+int exporter_config(oconfig_item_t *ci);
+int receiver_config(oconfig_item_t *ci);
+
+int config_get_file(oconfig_item_t const *ci, grpc::string *out);
+
+#endif
index 795bbd7ca5ee8e15d60fa7969c5c65d6ca6abe8c..443a65f1fb7eb8a840f4941c6768f95c09ef6609 100644 (file)
@@ -38,12 +38,13 @@ extern "C" {
 }
 
 #include <fstream>
-
 #include <grpc++/grpc++.h>
 
 #include "opentelemetry/proto/collector/metrics/v1/metrics_service.grpc.pb.h"
 #include "utils/format_open_telemetry/format_open_telemetry.h"
 
+#include "open_telemetry.h"
+
 #ifndef OT_DEFAULT_PORT
 #define OT_DEFAULT_PORT "4317"
 #endif
index 921f26e0ac679b1e5c7c9913153aee355ab62c09..c0dd114fdf57290f205054e9f77feaecf230721b 100644 (file)
@@ -47,6 +47,8 @@ extern "C" {
 #include "opentelemetry/proto/metrics/v1/metrics.pb.h"
 #include "opentelemetry/proto/resource/v1/resource.pb.h"
 
+#include "open_telemetry.h"
+
 #ifndef OT_DEFAULT_PORT
 #define OT_DEFAULT_PORT "4317"
 #endif
@@ -427,9 +429,6 @@ static void receiver_install_callbacks(void) {
   done = true;
 }
 
-// config_get_file is implemented in src/open_telemetry_exporter.cc
-int config_get_file(oconfig_item_t const *ci, grpc::string *out);
-
 /*
  * collectd plugin interface
  */