solarwinds_apm 5.1.6 → 5.1.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +21 -1
- data/ext/oboe_metal/lib/liboboe-1.0-aarch64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-aarch64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-alpine-x86_64.so.sha256 +1 -1
- data/ext/oboe_metal/lib/liboboe-1.0-x86_64.so.sha256 +1 -1
- data/ext/oboe_metal/src/VERSION +1 -1
- data/ext/oboe_metal/src/oboe.h +14 -270
- data/ext/oboe_metal/src/oboe_api.cpp +27 -43
- data/ext/oboe_metal/src/oboe_api.h +84 -45
- data/ext/oboe_metal/src/oboe_debug.h +275 -8
- data/ext/oboe_metal/src/oboe_swig_wrap.cc +470 -99
- data/lib/solarwinds_apm/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 38400d874e2a05decf3eb4e7691ac398dc41176bb904a72a58e38006440cee4f
|
4
|
+
data.tar.gz: 2ae5f68730f05b225293a983a13583103b1cbe02bbd906d8ad2aa4a7b074622a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 712b3ce5b8dafdf5b53c0bbec9da080a4f28ea34ed798d227a965c611b09775147f5145572c4200fef7034ca5233c2b06b58d5064ec798a162f8d7d76020d9fa
|
7
|
+
data.tar.gz: 054b79133ed377c8d47ab9ce79cdd41519c8bb9f4ef8187d397d6893f0ad3a2a6a6329d22e9e6297b44e9c09d6194b6027e4ec3c7a7ff680d1dc4bcac0371ee6
|
data/CHANGELOG.md
CHANGED
@@ -3,6 +3,26 @@ https://github.com/solarwindscloud/solarwinds-apm-ruby/releases
|
|
3
3
|
|
4
4
|
Dates in this file are in the format MM/DD/YYYY.
|
5
5
|
|
6
|
+
# solarwinds_apm 5.1.8 (05/09/2023)
|
7
|
+
|
8
|
+
This release includes the following features:
|
9
|
+
|
10
|
+
* Update latest liboboe library (12.2.0)
|
11
|
+
|
12
|
+
Pushed to Rubygems:
|
13
|
+
|
14
|
+
https://rubygems.org/gems/solarwinds_apm/versions/5.1.8
|
15
|
+
|
16
|
+
# solarwinds_apm 5.1.7 (03/14/2023)
|
17
|
+
|
18
|
+
This release includes the following features:
|
19
|
+
|
20
|
+
* Update latest liboboe library (12.1.0)
|
21
|
+
|
22
|
+
Pushed to Rubygems:
|
23
|
+
|
24
|
+
https://rubygems.org/gems/solarwinds_apm/versions/5.1.7
|
25
|
+
|
6
26
|
# solarwinds_apm 5.1.6 (03/14/2023)
|
7
27
|
|
8
28
|
This release includes the following features:
|
@@ -13,7 +33,7 @@ This release includes the following features:
|
|
13
33
|
|
14
34
|
Pushed to Rubygems:
|
15
35
|
|
16
|
-
https://rubygems.org/gems/solarwinds_apm/versions/5.1.
|
36
|
+
https://rubygems.org/gems/solarwinds_apm/versions/5.1.6
|
17
37
|
|
18
38
|
|
19
39
|
# solarwinds_apm 5.1.4 (11/23/2022)
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
5a62c8d1bd4cb5970a1a2e20b5d6424203a783b6d5ae17bffa90f7c8cac1b49a
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
0b2d8c81c9180d44206f89e01f76c4f6ae1dc49f289918b8544083afff66086c
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
6443f871141df922693f30a3fbc9772d7af7341539286168e42de51073336daa
|
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
bc83cb241947ad798285fe152dab4f7dd135075a303b128c4d5be7dea0ef9620
|
data/ext/oboe_metal/src/VERSION
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
12.
|
1
|
+
12.2.0
|
2
2
|
|
data/ext/oboe_metal/src/oboe.h
CHANGED
@@ -29,12 +29,6 @@ extern "C" {
|
|
29
29
|
#include "bson/bson.h"
|
30
30
|
#include "oboe_debug.h"
|
31
31
|
|
32
|
-
/** Compile time debug logging detail level - cannot log more detailed than this. */
|
33
|
-
#define OBOE_DEBUG_LEVEL OBOE_DEBUG_HIGH
|
34
|
-
|
35
|
-
/** Limit for number of messages at specified level before demoting to debug MEDIUM. */
|
36
|
-
#define MAX_DEBUG_MSG_COUNT 1
|
37
|
-
|
38
32
|
/**
|
39
33
|
* Default configuration settings update interval in seconds.
|
40
34
|
*
|
@@ -85,7 +79,7 @@ extern "C" {
|
|
85
79
|
/**
|
86
80
|
* Default EC2 metadata timeout in milliseconds
|
87
81
|
*/
|
88
|
-
#define OBOE_DEFAULT_EC2_METADATA_TIMEOUT
|
82
|
+
#define OBOE_DEFAULT_EC2_METADATA_TIMEOUT 50
|
89
83
|
|
90
84
|
#define OBOE_SAMPLE_RESOLUTION 1000000
|
91
85
|
|
@@ -772,268 +766,6 @@ extern int oboe_config_check_version(int version, int revision);
|
|
772
766
|
*/
|
773
767
|
extern int oboe_config_get_version();
|
774
768
|
|
775
|
-
/**
|
776
|
-
* Prototype for a logger call-back function.
|
777
|
-
*
|
778
|
-
* A logging function of this form can be added to the logger chain using
|
779
|
-
* oboe_debug_log_add().
|
780
|
-
*
|
781
|
-
* @param context The context pointer that was registered in the call to
|
782
|
-
* oboe_debug_log_add(). Use it to pass the pointer-to-self for
|
783
|
-
* objects (ie. "this" in C++) or just a structure in C, May be
|
784
|
-
* NULL.
|
785
|
-
* @param module The module identifier as passed to oboe_debug_logger().
|
786
|
-
* @param level The diagnostic detail level as passed to oboe_debug_logger().
|
787
|
-
* @param source_name Name of the source file as passed to oboe_debug_logger().
|
788
|
-
* @param source_lineno Number of the line in the source file where message is
|
789
|
-
* logged from as passed to oboe_debug_logger().
|
790
|
-
* @param msg The formatted message produced from the format string and its
|
791
|
-
* arguments as passed to oboe_debug_logger().
|
792
|
-
*/
|
793
|
-
typedef void (*OboeDebugLoggerFcn)(void *context, int module, int level, const char *source_name, int source_lineno, const char *msg);
|
794
|
-
|
795
|
-
/**
|
796
|
-
* Get a printable name for a diagnostics logging level.
|
797
|
-
*/
|
798
|
-
extern const char *oboe_debug_log_level_name(int level);
|
799
|
-
|
800
|
-
/**
|
801
|
-
* Get a printable name for a diagnostics logging module identifier.
|
802
|
-
*/
|
803
|
-
extern const char *oboe_debug_module_name(int module);
|
804
|
-
|
805
|
-
/**
|
806
|
-
* Get the maximum logging detail level for a module or for all modules.
|
807
|
-
*
|
808
|
-
* This level applies to the stderr logger only. Added loggers get all messages
|
809
|
-
* below their registed detail level and need to do their own module-specific
|
810
|
-
* filtering.
|
811
|
-
*
|
812
|
-
* @param module One of the OBOE_MODULE_* values. Use OBOE_MODULE_ALL (-1) to
|
813
|
-
* get the overall maximum detail level.
|
814
|
-
* @return Maximum detail level value for module (or overall) where zero is the
|
815
|
-
* lowest and higher values generate more detailed log messages.
|
816
|
-
*/
|
817
|
-
extern int oboe_debug_log_level_get(int module);
|
818
|
-
|
819
|
-
/**
|
820
|
-
* Set the maximum logging detail level for a module or for all modules.
|
821
|
-
*
|
822
|
-
* This level applies to the stderr logger only. Added loggers get all messages
|
823
|
-
* below their registered detail level and need to do their own module-specific
|
824
|
-
* filtering.
|
825
|
-
*
|
826
|
-
* @param module One of the OBOE_MODULE_* values. Use OBOE_MODULE_ALL to set
|
827
|
-
* the overall maximum detail level.
|
828
|
-
* @param newLevel Maximum detail level value where zero is the lowest and higher
|
829
|
-
* values generate more detailed log messages.
|
830
|
-
*/
|
831
|
-
extern void oboe_debug_log_level_set(int module, int newLevel);
|
832
|
-
|
833
|
-
/**
|
834
|
-
* Set the output stream for the default logger.
|
835
|
-
*
|
836
|
-
* @param newStream A valid, open FILE* stream or NULL to disable the default logger.
|
837
|
-
* @return Zero on success; otherwise an error code (normally from errno).
|
838
|
-
*/
|
839
|
-
extern int oboe_debug_log_to_stream(FILE *newStream);
|
840
|
-
|
841
|
-
/**
|
842
|
-
* If we're logging to a stream, flush it.
|
843
|
-
*
|
844
|
-
* @return Zero on success; otherwise an error code (normally from errno).
|
845
|
-
*/
|
846
|
-
extern int oboe_debug_log_flush();
|
847
|
-
|
848
|
-
/**
|
849
|
-
* Set the default logger to write to the specified file.
|
850
|
-
*
|
851
|
-
* A NULL or empty path name will disable the default logger.
|
852
|
-
*
|
853
|
-
* If the file exists then it will be opened in append mode.
|
854
|
-
*
|
855
|
-
* @param pathname The path name of the
|
856
|
-
* @return Zero on success; otherwise an error code (normally from errno).
|
857
|
-
*/
|
858
|
-
extern int oboe_debug_log_to_file(const char *pathname);
|
859
|
-
|
860
|
-
/**
|
861
|
-
* Add a logger that takes messages up to a given logging detail level.
|
862
|
-
*
|
863
|
-
* This adds the logger to a chain in order of the logging level. Log messages
|
864
|
-
* are passed to each logger down the chain until the remaining loggers only
|
865
|
-
* accept messages of a lower detail level.
|
866
|
-
*
|
867
|
-
* @return Zero on success, one if re-registered with the new logging level, and
|
868
|
-
* otherwise a negative value to indicate an error.
|
869
|
-
*/
|
870
|
-
extern int oboe_debug_log_add(OboeDebugLoggerFcn newLogger, void *context, int logLevel);
|
871
|
-
|
872
|
-
/**
|
873
|
-
* Remove a logger.
|
874
|
-
*
|
875
|
-
* Remove the logger from the message handling chain.
|
876
|
-
*
|
877
|
-
* @return Zero on success, one if it was not found, and otherwise a negative
|
878
|
-
* value to indicate an error.
|
879
|
-
*/
|
880
|
-
extern int oboe_debug_log_remove(OboeDebugLoggerFcn oldLogger, void *context);
|
881
|
-
|
882
|
-
/*
|
883
|
-
* Log the application's Oboe configuration.
|
884
|
-
*
|
885
|
-
* We use this to get a reasonable standard format between apps.
|
886
|
-
*
|
887
|
-
* @param module An OBOE_MODULE_* module identifier. Use zero for undefined.
|
888
|
-
* @param app_name Either NULL or a pointer to a string containing a name for
|
889
|
-
* the application - will prefix the log entry. Useful when multiple
|
890
|
-
* apps log to the same destination.
|
891
|
-
* @param trace_mode A string identifying the configured tracing mode, one of:
|
892
|
-
* "enabled", "disabled", "unset", or "undef" (for invalid values)
|
893
|
-
* Use the oboe_tracing_mode_to_string() function to convert from
|
894
|
-
* numeric values.
|
895
|
-
* @param sample_rate The configured sampling rate: -1 for unset or a
|
896
|
-
* integer fraction of 1000000.
|
897
|
-
* @param reporter_type String identifying the type of reporter configured:
|
898
|
-
* One of 'udp' (the default), 'ssl', or 'file'.
|
899
|
-
* @param reporter_args The string of comma-separated key=value settings
|
900
|
-
* used to initialize the reporter.
|
901
|
-
* @param extra: Either NULL or a pointer to a string to be appended to
|
902
|
-
* the log message and designed to include a few other
|
903
|
-
* configuration parameters of interest.
|
904
|
-
*/
|
905
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_INFO
|
906
|
-
# define OBOE_DEBUG_LOG_CONFIG(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra) \
|
907
|
-
{ \
|
908
|
-
oboe_debug_logger(module, OBOE_DEBUG_INFO, __FILE__, __LINE__, \
|
909
|
-
"%s Oboe config: tracing=%s, sampling=%d, reporter=('%s', '%s') %s", \
|
910
|
-
(app_name == NULL ? "" : app_name), \
|
911
|
-
trace_mode, \
|
912
|
-
sample_rate, \
|
913
|
-
(reporter_type == NULL ? "?" : reporter_type), \
|
914
|
-
(reporter_args == NULL ? "?" : reporter_args), \
|
915
|
-
(extra == NULL ? "" : extra)); \
|
916
|
-
}
|
917
|
-
#else
|
918
|
-
# define OBOE_DEBUG_LOG_CONFIG(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra) {}
|
919
|
-
#endif
|
920
|
-
|
921
|
-
/**
|
922
|
-
* Log a fatal error.
|
923
|
-
*/
|
924
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_FATAL
|
925
|
-
# define OBOE_DEBUG_LOG_FATAL(module, ...) \
|
926
|
-
{ \
|
927
|
-
oboe_debug_logger(module, OBOE_DEBUG_FATAL, __FILE__, __LINE__, __VA_ARGS__); \
|
928
|
-
}
|
929
|
-
#else
|
930
|
-
# define OBOE_DEBUG_LOG_FATAL(module, format_string, ...) {}
|
931
|
-
#endif
|
932
|
-
|
933
|
-
/**
|
934
|
-
* Log a recoverable error.
|
935
|
-
*
|
936
|
-
* Each message is limited in the number of times that it will be reported at the
|
937
|
-
* ERROR level after which it will be logged at the debug MEDIUM level.
|
938
|
-
*/
|
939
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_ERROR
|
940
|
-
# define OBOE_DEBUG_LOG_ERROR(module, ...) \
|
941
|
-
{ \
|
942
|
-
static int usage_counter = 0; \
|
943
|
-
int loglev = (++usage_counter <= MAX_DEBUG_MSG_COUNT ? OBOE_DEBUG_ERROR : OBOE_DEBUG_MEDIUM); \
|
944
|
-
oboe_debug_logger(module, loglev, __FILE__, __LINE__, __VA_ARGS__); \
|
945
|
-
}
|
946
|
-
#else
|
947
|
-
# define OBOE_DEBUG_LOG_ERROR(module, format_string, ...) {}
|
948
|
-
#endif
|
949
|
-
|
950
|
-
/**
|
951
|
-
* Log a warning.
|
952
|
-
*
|
953
|
-
* Each message is limited in the number of times that it will be reported at the
|
954
|
-
* WARNING level after which it will be logged at the debug MEDIUM level.
|
955
|
-
*/
|
956
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_WARNING
|
957
|
-
# define OBOE_DEBUG_LOG_WARNING(module, ...) \
|
958
|
-
{ \
|
959
|
-
static int usage_counter = 0; \
|
960
|
-
int loglev = (++usage_counter <= MAX_DEBUG_MSG_COUNT ? OBOE_DEBUG_WARNING : OBOE_DEBUG_MEDIUM); \
|
961
|
-
oboe_debug_logger(module, loglev, __FILE__, __LINE__, __VA_ARGS__); \
|
962
|
-
}
|
963
|
-
#else
|
964
|
-
# define OBOE_DEBUG_LOG_WARNING(module, format_string,...) {}
|
965
|
-
#endif
|
966
|
-
|
967
|
-
/**
|
968
|
-
* Log an informative message.
|
969
|
-
*
|
970
|
-
* Each message is limited in the number of times that it will be reported at the
|
971
|
-
* INFO level after which it will be logged at the debug MEDIUM level.
|
972
|
-
*/
|
973
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_INFO
|
974
|
-
# define OBOE_DEBUG_LOG_INFO(module, ...) \
|
975
|
-
{ \
|
976
|
-
static int usage_counter = 0; \
|
977
|
-
int loglev = (++usage_counter <= MAX_DEBUG_MSG_COUNT ? OBOE_DEBUG_INFO : OBOE_DEBUG_MEDIUM); \
|
978
|
-
oboe_debug_logger(module, loglev, __FILE__, __LINE__, __VA_ARGS__); \
|
979
|
-
}
|
980
|
-
#else
|
981
|
-
# define OBOE_DEBUG_LOG_INFO(module, format_string, ...) {}
|
982
|
-
#endif
|
983
|
-
|
984
|
-
/**
|
985
|
-
* Log a low-detail diagnostic message.
|
986
|
-
*/
|
987
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_LOW
|
988
|
-
# define OBOE_DEBUG_LOG_LOW(module, ...) \
|
989
|
-
{ \
|
990
|
-
oboe_debug_logger(module, OBOE_DEBUG_LOW, __FILE__, __LINE__, __VA_ARGS__); \
|
991
|
-
}
|
992
|
-
#else
|
993
|
-
# define OBOE_DEBUG_LOG_LOW(module, format_string, ...) {}
|
994
|
-
#endif
|
995
|
-
|
996
|
-
/**
|
997
|
-
* Log a medium-detail diagnostic message.
|
998
|
-
*/
|
999
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_MEDIUM
|
1000
|
-
# define OBOE_DEBUG_LOG_MEDIUM(module, ...) \
|
1001
|
-
{ \
|
1002
|
-
oboe_debug_logger(module, OBOE_DEBUG_MEDIUM, __FILE__, __LINE__, __VA_ARGS__); \
|
1003
|
-
}
|
1004
|
-
#else
|
1005
|
-
# define OBOE_DEBUG_LOG_MEDIUM(module, ...) {}
|
1006
|
-
#endif
|
1007
|
-
|
1008
|
-
/**
|
1009
|
-
* Log a high-detail diagnostic message.
|
1010
|
-
*/
|
1011
|
-
#if OBOE_DEBUG_LEVEL >= OBOE_DEBUG_HIGH
|
1012
|
-
# define OBOE_DEBUG_LOG_HIGH(module, ...) \
|
1013
|
-
{ \
|
1014
|
-
oboe_debug_logger(module, OBOE_DEBUG_HIGH, __FILE__, __LINE__, __VA_ARGS__); \
|
1015
|
-
}
|
1016
|
-
#else
|
1017
|
-
# define OBOE_DEBUG_LOG_HIGH(module, format_string, ...) {}
|
1018
|
-
#endif
|
1019
|
-
|
1020
|
-
|
1021
|
-
/**
|
1022
|
-
* Low-level diagnostics logging function.
|
1023
|
-
*
|
1024
|
-
* This is normally used only by the OBOE_DEBUG_LOG_* function macros and not used directly.
|
1025
|
-
*
|
1026
|
-
* This function may be adapted to format and route diagnostic log messages as desired.
|
1027
|
-
*
|
1028
|
-
* @param module One of the numeric module identifiers defined in debug.h - used to control logging detail by module.
|
1029
|
-
* @param level Diagnostic detail level of this message - used to control logging volume by detail level.
|
1030
|
-
* @param source_name Name of the source file, if available, or another useful name, or NULL.
|
1031
|
-
* @param source_lineno Number of the line in the source file where message is logged from, if available, or zero.
|
1032
|
-
* @param format A C language printf format specification string.
|
1033
|
-
* @param args A variable argument list in VA_ARG format containing arguments for each argument specifier in the format.
|
1034
|
-
*/
|
1035
|
-
void oboe_debug_logger(int module, int level, const char *source_name, int source_lineno, const char *format, ...);
|
1036
|
-
|
1037
769
|
/**
|
1038
770
|
* Get the Oboe library revision number.
|
1039
771
|
*
|
@@ -1133,7 +865,7 @@ int oboe_get_profiling_interval();
|
|
1133
865
|
// Get server warning message
|
1134
866
|
const char* oboe_get_server_warning();
|
1135
867
|
|
1136
|
-
// Regex tools
|
868
|
+
// Regex tools (Deprecated)
|
1137
869
|
void* oboe_regex_new_expression(const char* exprString);
|
1138
870
|
void oboe_regex_delete_expression(void* expression);
|
1139
871
|
int oboe_regex_match(const char* string, void* expression);
|
@@ -1144,6 +876,18 @@ oboe_internal_stats_t* oboe_get_internal_stats();
|
|
1144
876
|
// Random
|
1145
877
|
void oboe_random_bytes(uint8_t bytes[], size_t sz);
|
1146
878
|
|
879
|
+
// oboe logging macro
|
880
|
+
#define OBOE_DEBUG_LOG_CONFIG(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra) OBOE_DEBUG_LOG_CONFIG_EX(module, app_name, trace_mode, sample_rate, reporter_type, reporter_args, extra)
|
881
|
+
#define OBOE_DEBUG_LOG_FATAL(module, ...) OBOE_DEBUG_LOG_FATAL_EX(module, __VA_ARGS__)
|
882
|
+
#define OBOE_DEBUG_LOG_ERROR(module, ...) OBOE_DEBUG_LOG_ERROR_EX(module, __VA_ARGS__)
|
883
|
+
#define OBOE_DEBUG_LOG_WARNING(module, ...) OBOE_DEBUG_LOG_WARNING_EX(module, __VA_ARGS__)
|
884
|
+
#define OBOE_DEBUG_LOG_INFO(module, ...) OBOE_DEBUG_LOG_INFO_EX(module, __VA_ARGS__)
|
885
|
+
#define OBOE_DEBUG_LOG_LOW(module, ...) OBOE_DEBUG_LOG_LOW_EX(module, __VA_ARGS__)
|
886
|
+
#define OBOE_DEBUG_LOG_MEDIUM(module, ...) OBOE_DEBUG_LOG_MEDIUM_EX(module, __VA_ARGS__)
|
887
|
+
#define OBOE_DEBUG_LOG_HIGH(module, ...) OBOE_DEBUG_LOG_HIGH_EX(module, __VA_ARGS__)
|
888
|
+
|
889
|
+
void oboe_init_once();
|
890
|
+
|
1147
891
|
#ifdef __cplusplus
|
1148
892
|
} // extern "C"
|
1149
893
|
#endif
|
@@ -1,14 +1,10 @@
|
|
1
1
|
/**
|
2
2
|
* @file oboe_api.cpp - C++ liboboe wrapper primarily used via swig interfaces
|
3
3
|
* by the python and ruby agents
|
4
|
-
|
5
|
-
* TODO: This doc is outdated
|
6
|
-
* This API should follow https://github.com/tracelytics/tracelons/wiki/Instrumentation-API
|
7
|
-
**/
|
4
|
+
*/
|
8
5
|
|
9
6
|
#include "oboe_api.h"
|
10
7
|
#include <algorithm>
|
11
|
-
/////// Metatdata ///////
|
12
8
|
|
13
9
|
Metadata::Metadata(const oboe_metadata_t *md) {
|
14
10
|
oboe_metadata_copy(this, md);
|
@@ -40,7 +36,7 @@ bool Metadata::isSampled() {
|
|
40
36
|
return oboe_metadata_is_sampled(this);
|
41
37
|
}
|
42
38
|
|
43
|
-
Metadata *Metadata::fromString(std::string s) {
|
39
|
+
Metadata *Metadata::fromString(const std::string& s) {
|
44
40
|
oboe_metadata_t md;
|
45
41
|
oboe_metadata_init(&md);
|
46
42
|
oboe_metadata_fromstr(&md, s.data(), s.size());
|
@@ -175,7 +171,7 @@ void Context::set(oboe_metadata_t *md) {
|
|
175
171
|
oboe_context_set(md);
|
176
172
|
}
|
177
173
|
|
178
|
-
void Context::fromString(std::string s) {
|
174
|
+
void Context::fromString(const std::string& s) {
|
179
175
|
oboe_context_set_fromstr(s.data(), s.size());
|
180
176
|
}
|
181
177
|
|
@@ -201,7 +197,7 @@ bool Context::isSampled() {
|
|
201
197
|
return oboe_context_is_sampled();
|
202
198
|
}
|
203
199
|
|
204
|
-
std::string Context::validateTransformServiceName(std::string service_key) {
|
200
|
+
std::string Context::validateTransformServiceName(const std::string& service_key) {
|
205
201
|
char service_key_cpy[71 + 1 + 256] = {0}; // Flawfinder: ignore, key=71, colon=1, name<=255
|
206
202
|
std::copy_n(service_key.begin(), std::min(service_key.size(), sizeof(service_key_cpy)), std::begin(service_key_cpy));
|
207
203
|
int len = strlen(service_key_cpy); // Flawfinder: ignore
|
@@ -226,20 +222,10 @@ bool Context::isLambda() {
|
|
226
222
|
return (bool) oboe_is_lambda();
|
227
223
|
}
|
228
224
|
|
229
|
-
/**
|
230
|
-
* Create a new event object that continues the trace context.
|
231
|
-
*
|
232
|
-
* NOTE: The returned object must be "delete"d.
|
233
|
-
*/
|
234
225
|
Event *Context::createEvent() {
|
235
226
|
return new Event(Context::get());
|
236
227
|
}
|
237
228
|
|
238
|
-
/**
|
239
|
-
* Create a new event object with a new trace context.
|
240
|
-
*
|
241
|
-
* NOTE: The returned object must be "delete"d.
|
242
|
-
*/
|
243
229
|
Event *Context::startTrace() {
|
244
230
|
oboe_metadata_t *md = Context::get();
|
245
231
|
oboe_metadata_random(md);
|
@@ -253,34 +239,36 @@ Event* Context::createEntry(const oboe_metadata_t *md, int64_t timestamp, const
|
|
253
239
|
* we need to set the thread local metadata the same task id as input parameter md but a different op_id.
|
254
240
|
*/
|
255
241
|
auto thread_local_md = Context::get();
|
242
|
+
// set the thread_local_md to md to fulfill the same trace id requirement in Reporter::sendReport & oboe_event_send
|
256
243
|
oboe_metadata_copy(thread_local_md, md);
|
257
|
-
// reset op_id to zeros
|
244
|
+
// reset op_id to zeros to fulfill the different op id requirement in Reporter::sendReport & oboe_event_send
|
258
245
|
memset(thread_local_md->ids.op_id, 0, OBOE_MAX_OP_ID_LEN);
|
259
246
|
|
260
247
|
auto event = new Event();
|
248
|
+
oboe_event_destroy(event);
|
261
249
|
oboe_event_init(event, md, md->ids.op_id);
|
262
|
-
|
263
|
-
|
264
|
-
|
265
|
-
|
250
|
+
|
251
|
+
event->addInfo("Label", std::string("entry"));
|
252
|
+
event->addInfo("Timestamp_u", timestamp);
|
253
|
+
if(parent_md) {
|
254
|
+
event->addEdge(const_cast<oboe_metadata*>(parent_md));
|
266
255
|
}
|
267
256
|
return event;
|
268
257
|
}
|
269
258
|
|
270
259
|
Event* Context::createEvent(int64_t timestamp) {
|
271
260
|
auto event = new Event(Context::get());
|
272
|
-
|
261
|
+
event->addInfo("Timestamp_u", timestamp);
|
273
262
|
return event;
|
274
263
|
}
|
275
264
|
|
276
265
|
Event* Context::createExit(int64_t timestamp) {
|
277
266
|
auto event = createEvent(timestamp);
|
278
|
-
|
267
|
+
event->addInfo("Label", std::string("exit"));
|
279
268
|
return event;
|
280
269
|
}
|
281
270
|
|
282
271
|
/////// Event ///////
|
283
|
-
|
284
272
|
Event::Event() {
|
285
273
|
oboe_event_init(this, Context::get(), NULL);
|
286
274
|
}
|
@@ -312,8 +300,8 @@ bool Event::addInfo(char *key, void *val) {
|
|
312
300
|
return true;
|
313
301
|
}
|
314
302
|
|
315
|
-
bool Event::addInfo(char *key, const std::string
|
316
|
-
return oboe_event_add_info(this, key, val.
|
303
|
+
bool Event::addInfo(char *key, const std::string& val) {
|
304
|
+
return oboe_event_add_info(this, key, val.c_str()) == 0;
|
317
305
|
}
|
318
306
|
|
319
307
|
bool Event::addInfo(char *key, long val) {
|
@@ -373,19 +361,9 @@ bool Event::addEdge(oboe_metadata_t *md) {
|
|
373
361
|
}
|
374
362
|
|
375
363
|
bool Event::addHostname() {
|
376
|
-
|
377
|
-
|
378
|
-
|
379
|
-
(void)gethostname(oboe_hostname, sizeof(oboe_hostname) - 1);
|
380
|
-
if (oboe_hostname[0] == '\0') {
|
381
|
-
// Something is wrong but we don't want to to report this more than
|
382
|
-
// once so we'll set it to a minimal non-empty string.
|
383
|
-
OBOE_DEBUG_LOG_WARNING(OBOE_MODULE_LIBOBOE, "Failed to get hostname, setting it to '?'");
|
384
|
-
oboe_hostname[0] = '?';
|
385
|
-
oboe_hostname[1] = '\0';
|
386
|
-
}
|
387
|
-
}
|
388
|
-
return oboe_event_add_info(this, "Hostname", oboe_hostname) == 0;
|
364
|
+
char host[256] = {0};
|
365
|
+
gethostname(host, sizeof(host)/sizeof(char));
|
366
|
+
return oboe_event_add_info(this, "Hostname", host) == 0;
|
389
367
|
}
|
390
368
|
|
391
369
|
bool Event::addContextOpId(const oboe_metadata_t *md) {
|
@@ -530,8 +508,14 @@ MetricTags::MetricTags(size_t count) {
|
|
530
508
|
|
531
509
|
MetricTags::~MetricTags() {
|
532
510
|
for (size_t i = 0; i < size; i++) {
|
533
|
-
|
534
|
-
|
511
|
+
if (tags[i].key) {
|
512
|
+
free(tags[i].key);
|
513
|
+
tags[i].key = nullptr;
|
514
|
+
}
|
515
|
+
if (tags[i].value) {
|
516
|
+
free(tags[i].value);
|
517
|
+
tags[i].value = nullptr;
|
518
|
+
}
|
535
519
|
}
|
536
520
|
delete[] tags;
|
537
521
|
}
|