|
24 | 24 | HYPERNODE_API_FPM_STATUS_APP_ENDPOINT = "/v2/nats/{}/hypernode.show-fpm-status" |
25 | 25 | HYPERNODE_API_BRANCHER_ENDPOINT = "/v2/brancher/{}/" |
26 | 26 | HYPERNODE_API_INSIGHTS_ANNOTATION_LIST_ENDPOINT = "/v2/insights-annotation/" |
| 27 | +HYPERNODE_API_INSIGHTS_ANNOTATION_CREATE_ENDPOINT = "/v2/insights-annotation/create/" |
27 | 28 | HYPERNODE_API_PRODUCT_APP_DETAIL_ENDPOINT = "/v2/product/app/{}/current/" |
28 | 29 | HYPERNODE_API_PRODUCT_LIST_ENDPOINT = "/v2/product/" |
29 | 30 | HYPERNODE_API_PRODUCT_PRICE_DETAIL_ENDPOINT = "/v2/product/{}/with_price/" |
@@ -958,6 +959,41 @@ def get_insights_annotations(self, params=None): |
958 | 959 | "GET", HYPERNODE_API_INSIGHTS_ANNOTATION_LIST_ENDPOINT, params=params |
959 | 960 | ) |
960 | 961 |
|
| 962 | + def create_insights_annotation(self, data): |
| 963 | + """ |
| 964 | + Create a custom Insights annotation for a Hypernode. The annotation |
| 965 | + is shown in the Insights graphs at the point in time given by |
| 966 | + 'x_axis' (a unix timestamp in seconds). Optionally restrict the |
| 967 | + annotation to specific graphs with 'metrics', a comma-separated list |
| 968 | + of metric names. When omitted, the annotation applies to all metrics. |
| 969 | + Example: |
| 970 | + > client.create_insights_annotation( |
| 971 | + > data={ |
| 972 | + > 'name': 'Deployed release 1.2.3', |
| 973 | + > 'x_axis': 1756384957, |
| 974 | + > 'app': 'yourhypernodeappname', |
| 975 | + > 'metrics': 'memory_usage' |
| 976 | + > } |
| 977 | + > ).json() |
| 978 | + > { |
| 979 | + > 'id': 123, |
| 980 | + > 'name': 'Deployed release 1.2.3', |
| 981 | + > 'x_axis': 1756384957, |
| 982 | + > 'app': 'yourhypernodeappname', |
| 983 | + > 'metrics': 'memory_usage', |
| 984 | + > 'created': '2025-08-28T12:42:37Z', |
| 985 | + > 'modified': '2025-08-28T12:42:37Z' |
| 986 | + > } |
| 987 | +
|
| 988 | + :param dict data: Data describing the Insights annotation to create. |
| 989 | + An example could be: {'name': 'Deployed release 1.2.3', |
| 990 | + 'x_axis': 1756384957, 'app': 'yourhypernodeappname'} |
| 991 | + :return obj response: The request response object |
| 992 | + """ |
| 993 | + return self.requests( |
| 994 | + "POST", HYPERNODE_API_INSIGHTS_ANNOTATION_CREATE_ENDPOINT, data=data |
| 995 | + ) |
| 996 | + |
961 | 997 | def create_brancher(self, app_name, data): |
962 | 998 | """ |
963 | 999 | Create a new branch (server replica) of your Hypernode. |
|
0 commit comments