| 1 | /* |
| 2 | * Prometheus Internal API |
| 3 | * |
| 4 | * Copyright (C) 2019 Sangoma, Inc. |
| 5 | * |
| 6 | * Matt Jordan <[email protected]> |
| 7 | * |
| 8 | * See http://www.asterisk.org for more information about |
| 9 | * the Asterisk project. Please do not directly contact |
| 10 | * any of the maintainers of this project for assistance; |
| 11 | * the project provides a web site, mailing lists and IRC |
| 12 | * channels for your use. |
| 13 | * |
| 14 | * This program is free software, distributed under the terms of |
| 15 | * the GNU General Public License Version 2. See the LICENSE file |
| 16 | * at the top of the source tree. |
| 17 | */ |
| 18 | |
| 19 | #ifndef PROMETHEUS_INTERNAL_H__ |
| 20 | #define PROMETHEUS_INTERNAL_H__ |
| 21 | |
| 22 | /*! |
| 23 | * \file |
| 24 | * |
| 25 | * \brief Prometheus Metric Internal API |
| 26 | * |
| 27 | * This module provides internal APIs for res_prometheus. |
| 28 | * It should not be used outsize of that module, and should |
| 29 | * typically only provide intialization functions for units that |
| 30 | * want to register metrics / handlers with the core API. |
| 31 | */ |
| 32 | |
| 33 | /*! |
| 34 | * \brief Retrieve the amount of time it took to perform the last scrape |
| 35 | * |
| 36 | * \details Time returned is in milliseconds |
| 37 | * |
| 38 | * \retval The scrape duration, in milliseconds |
| 39 | */ |
| 40 | int64_t prometheus_last_scrape_duration_get(void); |
| 41 | |
| 42 | /*! |
| 43 | * \brief Retrieve the timestamp when the last scrape occurred |
| 44 | * |
| 45 | * \retval The time when the last scrape occurred |
| 46 | */ |
| 47 | struct timeval prometheus_last_scrape_time_get(void); |
| 48 | |
| 49 | /*! |
| 50 | * \brief Get the raw output of what a scrape would produce |
| 51 | * |
| 52 | * \details |
| 53 | * It can be useful to dump what a scrape will look like. |
| 54 | * This function returns the raw string representation |
| 55 | * of the metrics. |
| 56 | * |
| 57 | * \retval NULL on error |
| 58 | * \retval Malloc'd ast_str on success |
| 59 | */ |
| 60 | struct ast_str *prometheus_scrape_to_string(void); |
| 61 | |
| 62 | /*! |
| 63 | * \brief Initialize CLI command |
| 64 | * |
| 65 | * \retval 0 success |
| 66 | * \retval -1 error |
| 67 | */ |
| 68 | int cli_init(void); |
| 69 | |
| 70 | /*! |
| 71 | * \brief Initialize channel metrics |
| 72 | * |
| 73 | * \retval 0 success |
| 74 | * \retval -1 error |
| 75 | */ |
| 76 | int channel_metrics_init(void); |
| 77 | |
| 78 | /*! |
| 79 | * \brief Initialize endpoint metrics |
| 80 | * |
| 81 | * \retval 0 success |
| 82 | * \retval -1 error |
| 83 | */ |
| 84 | int endpoint_metrics_init(void); |
| 85 | |
| 86 | /*! |
| 87 | * \brief Initialize bridge metrics |
| 88 | * |
| 89 | * \retval 0 success |
| 90 | * \retval -1 error |
| 91 | */ |
| 92 | int bridge_metrics_init(void); |
| 93 | |
| 94 | /*! |
| 95 | * \brief Initialize PJSIP outbound registration metrics |
| 96 | * |
| 97 | * \retval 0 success |
| 98 | * \retval -1 error |
| 99 | */ |
| 100 | int pjsip_outbound_registration_metrics_init(void); |
| 101 | |
| 102 | #endif /* #define PROMETHEUS_INTERNAL_H__ */ |