Skip to content

Commit b82efeb

Browse files
authored
Merge branch 'fluent:master' into master
2 parents cb56e6a + 1d4c4dc commit b82efeb

File tree

19 files changed

+383
-94
lines changed

19 files changed

+383
-94
lines changed

include/fluent-bit/flb_input_chunk.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ struct flb_input_chunk {
7878
#ifdef FLB_HAVE_CHUNK_TRACE
7979
struct flb_chunk_trace *trace;
8080
#endif /* FLB_HAVE_CHUNK_TRACE */
81+
double create_time; /* chunk creation time in seconds with fractional precision) */
8182
flb_route_mask_element *routes_mask; /* track the output plugins the chunk routes to */
8283
struct mk_list _head;
8384
};

include/fluent-bit/flb_opentelemetry.h

Lines changed: 26 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -27,26 +27,31 @@
2727
/* Error code values from flb_opentelemetry_logs.c */
2828
#define FLB_OTEL_LOGS_ERR_GENERIC_ERROR -1
2929

30-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_ROOT_OBJECT_TYPE 2
31-
#define FLB_OTEL_LOGS_ERR_RESOURCELOGS_MISSING 3
32-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_RESOURCELOGS_TYPE 4
33-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_RESOURCELOGS_ENTRY_TYPE 5
34-
#define FLB_OTEL_LOGS_ERR_SCOPELOGS_MISSING 6
35-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_SCOPELOGS_TYPE 7
36-
#define FLB_OTEL_LOGS_ERR_GROUP_METADATA 8
37-
#define FLB_OTEL_LOGS_ERR_SCOPE_METADATA 9
38-
#define FLB_OTEL_LOGS_ERR_SCOPE_KVLIST 10
39-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_LOGRECORDS_ENTRY_TYPE 11
40-
#define FLB_OTEL_LOGS_ERR_MISSING_TIMESTAMP 12
41-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_TIMESTAMP_TYPE 13
42-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_ATTRIBUTES_TYPE 14
43-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_BODY_TYPE 15
44-
#define FLB_OTEL_LOGS_ERR_MISSING_LOGRECORDS 16
45-
#define FLB_OTEL_LOGS_ERR_UNEXPECTED_LOGRECORDS_TYPE 17
46-
#define FLB_OTEL_LOGS_ERR_ENCODER_FAILURE 18
47-
#define FLB_OTEL_LOGS_ERR_APPEND_BODY_FAILURE 19
48-
#define FLB_OTEL_LOGS_ERR_INVALID_TRACE_ID 20
49-
#define FLB_OTEL_LOGS_ERR_INVALID_SPAN_ID 21
30+
enum {
31+
32+
/* resource errors */
33+
FLB_OTEL_RESOURCE_INVALID_ATTRIBUTE = 1,
34+
FLB_OTEL_LOGS_ERR_UNEXPECTED_ROOT_OBJECT_TYPE,
35+
FLB_OTEL_LOGS_ERR_RESOURCELOGS_MISSING,
36+
FLB_OTEL_LOGS_ERR_UNEXPECTED_RESOURCELOGS_TYPE,
37+
FLB_OTEL_LOGS_ERR_UNEXPECTED_RESOURCELOGS_ENTRY_TYPE,
38+
FLB_OTEL_LOGS_ERR_SCOPELOGS_MISSING,
39+
FLB_OTEL_LOGS_ERR_UNEXPECTED_SCOPELOGS_TYPE,
40+
FLB_OTEL_LOGS_ERR_GROUP_METADATA,
41+
FLB_OTEL_LOGS_ERR_SCOPE_METADATA,
42+
FLB_OTEL_LOGS_ERR_SCOPE_KVLIST,
43+
FLB_OTEL_LOGS_ERR_UNEXPECTED_LOGRECORDS_ENTRY_TYPE,
44+
FLB_OTEL_LOGS_ERR_MISSING_TIMESTAMP,
45+
FLB_OTEL_LOGS_ERR_UNEXPECTED_TIMESTAMP_TYPE,
46+
FLB_OTEL_LOGS_ERR_UNEXPECTED_ATTRIBUTES_TYPE,
47+
FLB_OTEL_LOGS_ERR_UNEXPECTED_BODY_TYPE,
48+
FLB_OTEL_LOGS_ERR_MISSING_LOGRECORDS,
49+
FLB_OTEL_LOGS_ERR_UNEXPECTED_LOGRECORDS_TYPE,
50+
FLB_OTEL_LOGS_ERR_ENCODER_FAILURE,
51+
FLB_OTEL_LOGS_ERR_APPEND_BODY_FAILURE,
52+
FLB_OTEL_LOGS_ERR_INVALID_TRACE_ID,
53+
FLB_OTEL_LOGS_ERR_INVALID_SPAN_ID
54+
};
5055

5156

5257
/*
@@ -62,6 +67,7 @@ struct flb_otel_error_map {
6267
};
6368

6469
static struct flb_otel_error_map otel_error_map[] = {
70+
{"FLB_OTEL_RESOURCE_INVALID_ATTRIBUTE", FLB_OTEL_RESOURCE_INVALID_ATTRIBUTE},
6571
{"FLB_OTEL_LOGS_ERR_UNEXPECTED_ROOT_OBJECT_TYPE", FLB_OTEL_LOGS_ERR_UNEXPECTED_ROOT_OBJECT_TYPE},
6672
{"FLB_OTEL_LOGS_ERR_RESOURCELOGS_MISSING", FLB_OTEL_LOGS_ERR_RESOURCELOGS_MISSING},
6773
{"FLB_OTEL_LOGS_ERR_UNEXPECTED_RESOURCELOGS_TYPE", FLB_OTEL_LOGS_ERR_UNEXPECTED_RESOURCELOGS_TYPE},

include/fluent-bit/flb_output.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252
#include <cmetrics/cmetrics.h>
5353
#include <cmetrics/cmt_gauge.h>
5454
#include <cmetrics/cmt_counter.h>
55+
#include <cmetrics/cmt_histogram.h>
5556
#include <cmetrics/cmt_decode_msgpack.h>
5657
#include <cmetrics/cmt_encode_msgpack.h>
5758

@@ -454,6 +455,8 @@ struct flb_output_instance {
454455
struct cmt_gauge *cmt_upstream_busy_connections;
455456
/* m: output_chunk_available_capacity_percent */
456457
struct cmt_gauge *cmt_chunk_available_capacity_percent;
458+
/* m: output_latency_seconds */
459+
struct cmt_histogram *cmt_latency;
457460

458461
/* OLD Metrics API */
459462
#ifdef FLB_HAVE_METRICS

plugins/in_nginx_exporter_metrics/nginx.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2271,7 +2271,7 @@ static int nginx_init(struct flb_input_instance *ins,
22712271
}
22722272
ctx->coll_id = flb_input_set_collector_time(ins,
22732273
nginx_collect,
2274-
1,
2274+
ctx->scrape_interval,
22752275
0, config);
22762276
ret = 0;
22772277
nginx_init_end:
@@ -2340,6 +2340,11 @@ static struct flb_config_map config_map[] = {
23402340
0, FLB_TRUE, offsetof(struct nginx_ctx, status_url),
23412341
"Define URL of stub status handler"
23422342
},
2343+
{
2344+
FLB_CONFIG_MAP_TIME, "scrape_interval", "5s",
2345+
0, FLB_TRUE, offsetof(struct nginx_ctx, scrape_interval),
2346+
"Scrape interval to collect metrics from NGINX."
2347+
},
23432348
{
23442349
FLB_CONFIG_MAP_BOOL, "nginx_plus", "true",
23452350
0, FLB_TRUE, offsetof(struct nginx_ctx, is_nginx_plus),

plugins/in_nginx_exporter_metrics/nginx.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@
3030
struct nginx_ctx
3131
{
3232
int coll_id; /* collector id */
33+
int scrape_interval; /* collection interval */
3334
flb_sds_t status_url;
3435
struct flb_parser *parser;
3536
struct flb_input_instance *ins; /* Input plugin instace */

plugins/in_opentelemetry/opentelemetry_logs.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,11 @@ static int otlp_pack_any_value(msgpack_packer *mp_pck,
142142

143143
result = -2;
144144

145+
if (body == NULL) {
146+
msgpack_pack_nil(mp_pck);
147+
return 0;
148+
}
149+
145150
switch(body->value_case){
146151
case OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_STRING_VALUE:
147152
result = otel_pack_string(mp_pck, body->string_value);
@@ -537,6 +542,7 @@ static int binary_payload_to_msgpack(struct flb_opentelemetry *ctx,
537542
}
538543
else {
539544
if (ctx->logs_body_key == NULL &&
545+
log_records[log_record_index]->body != NULL &&
540546
log_records[log_record_index]->body->value_case ==
541547
OPENTELEMETRY__PROTO__COMMON__V1__ANY_VALUE__VALUE_KVLIST_VALUE) {
542548
ret = flb_log_event_encoder_set_body_from_raw_msgpack(

plugins/in_windows_exporter_metrics/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ set(src
2525
set(libs
2626
wbemuuid
2727
netapi32
28+
iphlpapi
2829
)
2930

3031
FLB_PLUGIN(in_windows_exporter_metrics "${src}" "${libs}")

plugins/in_windows_exporter_metrics/we.h

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -236,15 +236,16 @@ struct we_wmi_tcp_counters {
236236
struct wmi_query_spec *v4_info;
237237
struct wmi_query_spec *v6_info;
238238

239+
struct cmt_gauge *connections_state;
239240
struct cmt_counter *connection_failures;
240241
struct cmt_gauge *connections_active;
241242
struct cmt_counter *connections_established;
242243
struct cmt_counter *connections_passive;
243244
struct cmt_counter *connections_reset;
244-
struct cmt_gauge *segments_per_sec;
245-
struct cmt_gauge *segments_received_per_sec;
246-
struct cmt_gauge *segments_retransmitted_per_sec;
247-
struct cmt_gauge *segments_sent_per_sec;
245+
struct cmt_gauge *segments_total;
246+
struct cmt_gauge *segments_received_total;
247+
struct cmt_gauge *segments_retransmitted_total;
248+
struct cmt_gauge *segments_sent_total;
248249
};
249250

250251
struct we_os_counters {

0 commit comments

Comments
 (0)