prom: basic builtin prometheus stats exporter
[vpp.git] / src / plugins / prom / prom.h
1 /*
2  * Copyright (c) 2022 Cisco and/or its affiliates.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at:
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15
16 #ifndef SRC_PLUGINS_PROM_PROM_H_
17 #define SRC_PLUGINS_PROM_PROM_H_
18
19 #include <vnet/session/session.h>
20 #include <http_static/http_static.h>
21
22 typedef struct prom_main_
23 {
24   u8 *stats;
25   f64 last_scrape;
26   hss_register_url_fn register_url;
27   hss_session_send_fn send_data;
28   u32 scraper_node_index;
29   u8 is_enabled;
30
31   u8 **stats_patterns;
32   f64 min_scrape_interval;
33   u8 used_only;
34   vlib_main_t *vm;
35 } prom_main_t;
36
37 typedef enum prom_process_evt_codes_
38 {
39   PROM_SCRAPER_EVT_RUN,
40 } prom_process_evt_codes_t;
41
42 void prom_enable (vlib_main_t *vm);
43 prom_main_t *prom_get_main (void);
44
45 void prom_stat_patterns_set (u8 **patterns);
46 void prom_stat_patterns_add (u8 **patterns);
47 u8 **prom_stat_patterns_get (void);
48 void prom_stat_patterns_free (void);
49
50 #endif /* SRC_PLUGINS_PROM_PROM_H_ */
51
52 /*
53  * fd.io coding-style-patch-verification: ON
54  *
55  * Local Variables:
56  * eval: (c-set-style "gnu")
57  * End:
58  */