Loading...
Searching...
No Matches
as_metrics_writer.h
Go to the documentation of this file.
1/*
2 * Copyright 2008-2024 Aerospike, Inc.
3 *
4 * Portions may be licensed to Aerospike, Inc. under one or more contributor
5 * license agreements.
6 *
7 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
8 * use this file except in compliance with the License. You may obtain a copy of
9 * the License at http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
13 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
14 * License for the specific language governing permissions and limitations under
15 * the License.
16 */
17#pragma once
18
20#include <aerospike/as_error.h>
22#include <aerospike/as_status.h>
23#include <stdio.h>
24
25#if defined(_MSC_VER)
26#define WIN32_LEAN_AND_MEAN
27#include <windows.h>
28#endif
29
30#ifdef __cplusplus
31extern "C" {
32#endif
33
34//---------------------------------
35// Types
36//---------------------------------
37
38/**
39 * Default metrics listener. This implementation writes periodic metrics snapshots to a file which
40 * will later be read and forwarded to OpenTelemetry by a separate offline application.
41 */
42typedef struct as_metrics_writer_s {
43 char report_dir[256];
44 FILE* file;
45 uint64_t max_size;
46 uint64_t size;
48 uint32_t latency_shift;
49#ifdef _MSC_VER
50 FILETIME prev_process_times_kernel;
51 FILETIME prev_system_times_kernel;
52 FILETIME prev_process_times_user;
53 FILETIME prev_system_times_user;
54 HANDLE process;
55 DWORD pid;
56#endif
57 bool enable;
59
60//---------------------------------
61// Functions
62//---------------------------------
63
66
69
71as_metrics_writer_snapshot(as_error* err, as_cluster* cluster, void* udata);
72
74as_metrics_writer_node_close(as_error* err, struct as_node_s* node, void* udata);
75
77as_metrics_writer_disable(as_error* err, struct as_cluster_s* cluster, void* udata);
78
79#ifdef __cplusplus
80} // end extern "C"
81#endif
AS_EXTERN as_status as_metrics_writer_snapshot(as_error *err, as_cluster *cluster, void *udata)
AS_EXTERN as_status as_metrics_writer_enable(as_error *err, void *udata)
AS_EXTERN as_status as_metrics_writer_disable(as_error *err, struct as_cluster_s *cluster, void *udata)
AS_EXTERN as_status as_metrics_writer_node_close(as_error *err, struct as_node_s *node, void *udata)
AS_EXTERN as_status as_metrics_writer_create(as_error *err, const as_metrics_policy *policy, as_metrics_listeners *listeners)
as_status
Definition as_status.h:30
#define AS_EXTERN
Definition as_std.h:25