Skip to content

Commit 4df5157

Browse files
committed
encode_cloudwatch_emf_payload: Support EMF adopted payload encoder
Signed-off-by: Hiroshi Hatake <[email protected]>
1 parent f294339 commit 4df5157

File tree

4 files changed

+561
-0
lines changed

4 files changed

+561
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2+
3+
/* CMetrics
4+
* ========
5+
* Copyright 2024 The CMetrics Authors
6+
*
7+
* Licensed under the Apache License, Version 2.0 (the "License");
8+
* you may not use this file except in compliance with the License.
9+
* You may obtain a copy of the License at
10+
*
11+
* http://www.apache.org/licenses/LICENSE-2.0
12+
*
13+
* Unless required by applicable law or agreed to in writing, software
14+
* distributed under the License is distributed on an "AS IS" BASIS,
15+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16+
* See the License for the specific language governing permissions and
17+
* limitations under the License.
18+
*/
19+
20+
21+
#ifndef CMT_ENCODE_CLOUDWATCH_EMF_PAYLOAD_H
22+
#define CMT_ENCODE_CLOUDWATCH_EMF_PAYLOAD_H
23+
24+
#include <time.h>
25+
#include <cfl/cfl.h>
26+
#include <cmetrics/cmetrics.h>
27+
28+
#define CMT_ENCODE_CLOUDWATCH_EMF_PAYLOAD_SUCCESS 0
29+
#define CMT_ENCODE_CLOUDWATCH_EMF_PAYLOAD_INVALID_ARGUMENT_ERROR -1
30+
#define CMT_ENCODE_CLOUDWATCH_EMF_PAYLOAD_CREATION_FAILED -2
31+
#define CMT_ENCODE_CLOUDWATCH_EMF_PAYLOAD_INVALID_DATA_ERROR -4
32+
33+
/* Metric Unit */
34+
#define CMT_EMF_UNIT_PERCENT "Percent"
35+
#define CMT_EMF_UNIT_BYTES "Bytes"
36+
#define CMT_EMF_UNIT_COUNTER "Counter"
37+
38+
int cmt_encode_cloudwatch_emf_payload_create(struct cmt *cmt,
39+
char **out_buf, size_t *out_size,
40+
int wrap_array);
41+
void cmt_encode_cloudwatch_emf_payload_destroy(char *out_buf);
42+
43+
#endif

src/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ set(src
2828
cmt_encode_prometheus.c
2929
cmt_encode_prometheus_remote_write.c
3030
cmt_encode_splunk_hec.c
31+
cmt_encode_cloudwatch_emf_payload.c
3132
cmt_encode_text.c
3233
cmt_encode_influx.c
3334
cmt_encode_msgpack.c

0 commit comments

Comments
 (0)