react-native-nitro-tracing 0.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +38 -0
- package/LICENSE +21 -0
- package/NitroTracing.podspec +32 -0
- package/README.md +75 -0
- package/android/CMakeLists.txt +49 -0
- package/android/build.gradle +133 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/proguard-rules.pro +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +47 -0
- package/android/src/main/java/com/margelo/nitro/nitrotracing/HermesSamplingGuard.kt +43 -0
- package/android/src/main/java/com/margelo/nitro/nitrotracing/NitroTracingFrameSource.kt +36 -0
- package/android/src/main/java/com/margelo/nitro/nitrotracing/NitroTracingPackage.kt +31 -0
- package/client.ts +15 -0
- package/cpp/HermesSampling.cpp +26 -0
- package/cpp/HermesSampling.hpp +10 -0
- package/cpp/HybridRecording.cpp +66 -0
- package/cpp/HybridRecording.hpp +30 -0
- package/cpp/HybridTraceSpan.cpp +10 -0
- package/cpp/HybridTraceSpan.hpp +17 -0
- package/cpp/HybridTracing.cpp +10 -0
- package/cpp/HybridTracing.hpp +10 -0
- package/cpp/NativeConversions.cpp +77 -0
- package/cpp/NativeConversions.hpp +15 -0
- package/cpp/core/NativeSampler.cpp +152 -0
- package/cpp/core/NativeSampler.hpp +56 -0
- package/cpp/core/Recorder.cpp +218 -0
- package/cpp/core/Recorder.hpp +60 -0
- package/cpp/core/Retention.cpp +26 -0
- package/cpp/core/Retention.hpp +7 -0
- package/cpp/core/TraceJson.cpp +214 -0
- package/cpp/core/TraceJson.hpp +7 -0
- package/cpp/core/TraceTypes.hpp +62 -0
- package/expo.ts +2 -0
- package/ios/NitroTracingFrameSource.mm +35 -0
- package/lib/commonjs/client.cjs +767 -0
- package/lib/commonjs/client.cjs.map +7 -0
- package/lib/commonjs/expo.cjs +88 -0
- package/lib/commonjs/expo.cjs.map +7 -0
- package/lib/commonjs/index.cjs +28 -0
- package/lib/commonjs/index.cjs.map +7 -0
- package/lib/commonjs/performance.cjs +112 -0
- package/lib/commonjs/performance.cjs.map +7 -0
- package/lib/commonjs/plugins.cjs +477 -0
- package/lib/commonjs/plugins.cjs.map +7 -0
- package/lib/commonjs/react.cjs +3833 -0
- package/lib/commonjs/react.cjs.map +7 -0
- package/lib/commonjs/release-profiler.cjs +142 -0
- package/lib/commonjs/release-profiler.cjs.map +7 -0
- package/lib/commonjs/sentry.cjs +188 -0
- package/lib/commonjs/sentry.cjs.map +7 -0
- package/lib/module/client.mjs +768 -0
- package/lib/module/client.mjs.map +7 -0
- package/lib/module/expo.mjs +62 -0
- package/lib/module/expo.mjs.map +7 -0
- package/lib/module/index.mjs +7 -0
- package/lib/module/index.mjs.map +7 -0
- package/lib/module/performance.mjs +89 -0
- package/lib/module/performance.mjs.map +7 -0
- package/lib/module/plugins.mjs +461 -0
- package/lib/module/plugins.mjs.map +7 -0
- package/lib/module/react.mjs +3851 -0
- package/lib/module/react.mjs.map +7 -0
- package/lib/module/release-profiler.mjs +137 -0
- package/lib/module/release-profiler.mjs.map +7 -0
- package/lib/module/sentry.mjs +165 -0
- package/lib/module/sentry.mjs.map +7 -0
- package/lib/typescript/client.d.ts +4 -0
- package/lib/typescript/expo.d.ts +2 -0
- package/lib/typescript/performance.d.ts +2 -0
- package/lib/typescript/plugins.d.ts +12 -0
- package/lib/typescript/react.d.ts +5 -0
- package/lib/typescript/release-profiler.d.ts +2 -0
- package/lib/typescript/sentry.d.ts +2 -0
- package/lib/typescript/src/client/TracingSink.d.ts +10 -0
- package/lib/typescript/src/client/createTraceClient.d.ts +82 -0
- package/lib/typescript/src/client/playground.d.ts +12 -0
- package/lib/typescript/src/expo/ExpoAdapter.d.ts +15 -0
- package/lib/typescript/src/expo/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts +6 -0
- package/lib/typescript/src/plugins/TracePlugin.d.ts +22 -0
- package/lib/typescript/src/plugins/errors.d.ts +15 -0
- package/lib/typescript/src/plugins/nativeMetrics.d.ts +13 -0
- package/lib/typescript/src/plugins/navigation.d.ts +29 -0
- package/lib/typescript/src/plugins/network.d.ts +23 -0
- package/lib/typescript/src/plugins/orderSpans.d.ts +3 -0
- package/lib/typescript/src/plugins/performance.d.ts +13 -0
- package/lib/typescript/src/plugins/releaseProfiler.d.ts +25 -0
- package/lib/typescript/src/plugins/runtimeMetrics.d.ts +17 -0
- package/lib/typescript/src/plugins/sentry.d.ts +15 -0
- package/lib/typescript/src/plugins/startPlugins.d.ts +4 -0
- package/lib/typescript/src/react/DetailView.d.ts +11 -0
- package/lib/typescript/src/react/ExplorerFilters.d.ts +9 -0
- package/lib/typescript/src/react/ExplorerView.d.ts +9 -0
- package/lib/typescript/src/react/InspectorControls.d.ts +229 -0
- package/lib/typescript/src/react/InspectorHeader.d.ts +8 -0
- package/lib/typescript/src/react/InspectorSheet.d.ts +16 -0
- package/lib/typescript/src/react/MetricsView.d.ts +7 -0
- package/lib/typescript/src/react/SummaryView.d.ts +11 -0
- package/lib/typescript/src/react/TimelineView.d.ts +8 -0
- package/lib/typescript/src/react/TraceInspector.d.ts +11 -0
- package/lib/typescript/src/react/TraceOverlay.d.ts +17 -0
- package/lib/typescript/src/react/explorerModel.d.ts +38 -0
- package/lib/typescript/src/react/labels.d.ts +203 -0
- package/lib/typescript/src/react/native.d.ts +42 -0
- package/lib/typescript/src/react/readSnapshot.d.ts +4 -0
- package/lib/typescript/src/react/store.d.ts +9 -0
- package/lib/typescript/src/react/topics.d.ts +80 -0
- package/lib/typescript/src/react/useAppReadyMetric.d.ts +3 -0
- package/lib/typescript/src/react/useLiveRecording.d.ts +4 -0
- package/lib/typescript/src/react/useTraceViewer.d.ts +140 -0
- package/lib/typescript/src/react/viewerModel.d.ts +59 -0
- package/lib/typescript/src/specs/Recording.nitro.d.ts +31 -0
- package/lib/typescript/src/specs/TraceSpan.nitro.d.ts +14 -0
- package/lib/typescript/src/specs/Tracing.nitro.d.ts +17 -0
- package/lib/typescript/src/types/CompletedSpanOptions.d.ts +15 -0
- package/lib/typescript/src/types/EventContext.d.ts +8 -0
- package/lib/typescript/src/types/MarkEvent.d.ts +4 -0
- package/lib/typescript/src/types/MarkOptions.d.ts +6 -0
- package/lib/typescript/src/types/MetricEvent.d.ts +8 -0
- package/lib/typescript/src/types/MetricOptions.d.ts +10 -0
- package/lib/typescript/src/types/NativeSamplingOptions.d.ts +7 -0
- package/lib/typescript/src/types/ReadOptions.d.ts +7 -0
- package/lib/typescript/src/types/RecordingOptions.d.ts +11 -0
- package/lib/typescript/src/types/RecordingStats.d.ts +25 -0
- package/lib/typescript/src/types/SpanEvent.d.ts +13 -0
- package/lib/typescript/src/types/SpanOptions.d.ts +6 -0
- package/lib/typescript/src/types/SpanOutcome.d.ts +2 -0
- package/lib/typescript/src/types/TraceAttribute.d.ts +7 -0
- package/lib/typescript/src/types/TraceAttributes.d.ts +3 -0
- package/lib/typescript/src/types/TraceContext.d.ts +10 -0
- package/lib/typescript/src/types/TracePage.d.ts +18 -0
- package/lib/typescript/src/types.d.ts +17 -0
- package/nitro.json +20 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroTracing+autolinking.cmake +83 -0
- package/nitrogen/generated/android/NitroTracing+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroTracingOnLoad.cpp +49 -0
- package/nitrogen/generated/android/NitroTracingOnLoad.hpp +34 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/nitrotracing/NitroTracingOnLoad.kt +35 -0
- package/nitrogen/generated/ios/NitroTracing+autolinking.rb +62 -0
- package/nitrogen/generated/ios/NitroTracing-Swift-Cxx-Bridge.cpp +17 -0
- package/nitrogen/generated/ios/NitroTracing-Swift-Cxx-Bridge.hpp +27 -0
- package/nitrogen/generated/ios/NitroTracing-Swift-Cxx-Umbrella.hpp +38 -0
- package/nitrogen/generated/ios/NitroTracingAutolinking.mm +35 -0
- package/nitrogen/generated/ios/NitroTracingAutolinking.swift +16 -0
- package/nitrogen/generated/shared/c++/CompletedSpanOptions.hpp +122 -0
- package/nitrogen/generated/shared/c++/HybridRecordingSpec.cpp +31 -0
- package/nitrogen/generated/shared/c++/HybridRecordingSpec.hpp +100 -0
- package/nitrogen/generated/shared/c++/HybridTraceSpanSpec.cpp +23 -0
- package/nitrogen/generated/shared/c++/HybridTraceSpanSpec.hpp +65 -0
- package/nitrogen/generated/shared/c++/HybridTracingSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridTracingSpec.hpp +68 -0
- package/nitrogen/generated/shared/c++/MarkEvent.hpp +102 -0
- package/nitrogen/generated/shared/c++/MarkOptions.hpp +99 -0
- package/nitrogen/generated/shared/c++/MetricEvent.hpp +110 -0
- package/nitrogen/generated/shared/c++/MetricOptions.hpp +107 -0
- package/nitrogen/generated/shared/c++/NativeSamplingOptions.hpp +87 -0
- package/nitrogen/generated/shared/c++/ReadOptions.hpp +87 -0
- package/nitrogen/generated/shared/c++/RecordingOptions.hpp +95 -0
- package/nitrogen/generated/shared/c++/RecordingStats.hpp +123 -0
- package/nitrogen/generated/shared/c++/SpanEvent.hpp +121 -0
- package/nitrogen/generated/shared/c++/SpanOptions.hpp +99 -0
- package/nitrogen/generated/shared/c++/SpanOutcome.hpp +84 -0
- package/nitrogen/generated/shared/c++/TraceAttribute.hpp +87 -0
- package/nitrogen/generated/shared/c++/TracePage.hpp +111 -0
- package/package.json +236 -0
- package/performance.ts +2 -0
- package/plugins.ts +24 -0
- package/react-native.config.js +16 -0
- package/react.ts +10 -0
- package/release-profiler.ts +6 -0
- package/sentry.ts +2 -0
- package/src/client/TracingSink.ts +25 -0
- package/src/client/createTraceClient.ts +439 -0
- package/src/client/playground.ts +143 -0
- package/src/expo/ExpoAdapter.ts +71 -0
- package/src/expo/index.ts +2 -0
- package/src/index.ts +8 -0
- package/src/plugins/TracePlugin.ts +22 -0
- package/src/plugins/errors.ts +69 -0
- package/src/plugins/nativeMetrics.ts +26 -0
- package/src/plugins/navigation.ts +111 -0
- package/src/plugins/network.ts +178 -0
- package/src/plugins/orderSpans.ts +22 -0
- package/src/plugins/performance.ts +120 -0
- package/src/plugins/releaseProfiler.ts +123 -0
- package/src/plugins/runtimeMetrics.ts +131 -0
- package/src/plugins/sentry.ts +176 -0
- package/src/plugins/startPlugins.ts +58 -0
- package/src/react/DetailView.tsx +514 -0
- package/src/react/ExplorerFilters.tsx +151 -0
- package/src/react/ExplorerView.tsx +243 -0
- package/src/react/InspectorControls.tsx +651 -0
- package/src/react/InspectorHeader.tsx +171 -0
- package/src/react/InspectorSheet.tsx +89 -0
- package/src/react/MetricsView.tsx +182 -0
- package/src/react/SummaryView.tsx +121 -0
- package/src/react/TimelineView.tsx +87 -0
- package/src/react/TraceInspector.tsx +196 -0
- package/src/react/TraceOverlay.tsx +585 -0
- package/src/react/explorerModel.ts +285 -0
- package/src/react/labels.ts +234 -0
- package/src/react/native.tsx +159 -0
- package/src/react/readSnapshot.ts +58 -0
- package/src/react/store.ts +31 -0
- package/src/react/topics.ts +427 -0
- package/src/react/useAppReadyMetric.ts +10 -0
- package/src/react/useLiveRecording.ts +43 -0
- package/src/react/useTraceViewer.ts +333 -0
- package/src/react/viewerModel.ts +172 -0
- package/src/specs/Recording.nitro.ts +40 -0
- package/src/specs/TraceSpan.nitro.ts +14 -0
- package/src/specs/Tracing.nitro.ts +14 -0
- package/src/types/CompletedSpanOptions.ts +15 -0
- package/src/types/EventContext.ts +8 -0
- package/src/types/MarkEvent.ts +3 -0
- package/src/types/MarkOptions.ts +6 -0
- package/src/types/MetricEvent.ts +8 -0
- package/src/types/MetricOptions.ts +10 -0
- package/src/types/NativeSamplingOptions.ts +7 -0
- package/src/types/ReadOptions.ts +7 -0
- package/src/types/RecordingOptions.ts +11 -0
- package/src/types/RecordingStats.ts +25 -0
- package/src/types/SpanEvent.ts +13 -0
- package/src/types/SpanOptions.ts +6 -0
- package/src/types/SpanOutcome.ts +2 -0
- package/src/types/TraceAttribute.ts +7 -0
- package/src/types/TraceAttributes.ts +4 -0
- package/src/types/TraceContext.ts +10 -0
- package/src/types/TracePage.ts +18 -0
- package/src/types.ts +17 -0
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// CompletedSpanOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `SpanOutcome` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrotracing { enum class SpanOutcome; }
|
|
33
|
+
// Forward declaration of `TraceAttribute` to properly resolve imports.
|
|
34
|
+
namespace margelo::nitro::nitrotracing { struct TraceAttribute; }
|
|
35
|
+
|
|
36
|
+
#include <string>
|
|
37
|
+
#include <optional>
|
|
38
|
+
#include "SpanOutcome.hpp"
|
|
39
|
+
#include "TraceAttribute.hpp"
|
|
40
|
+
#include <vector>
|
|
41
|
+
|
|
42
|
+
namespace margelo::nitro::nitrotracing {
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* A struct which can be represented as a JavaScript object (CompletedSpanOptions).
|
|
46
|
+
*/
|
|
47
|
+
struct CompletedSpanOptions final {
|
|
48
|
+
public:
|
|
49
|
+
std::optional<std::string> sourceSpanId SWIFT_PRIVATE;
|
|
50
|
+
std::optional<std::string> sourceParentSpanId SWIFT_PRIVATE;
|
|
51
|
+
double timestampMs SWIFT_PRIVATE;
|
|
52
|
+
double durationMs SWIFT_PRIVATE;
|
|
53
|
+
SpanOutcome outcome SWIFT_PRIVATE;
|
|
54
|
+
std::optional<std::string> parentSpanId SWIFT_PRIVATE;
|
|
55
|
+
std::string name SWIFT_PRIVATE;
|
|
56
|
+
std::string correlationId SWIFT_PRIVATE;
|
|
57
|
+
std::vector<TraceAttribute> attributes SWIFT_PRIVATE;
|
|
58
|
+
|
|
59
|
+
public:
|
|
60
|
+
CompletedSpanOptions() = default;
|
|
61
|
+
explicit CompletedSpanOptions(std::optional<std::string> sourceSpanId, std::optional<std::string> sourceParentSpanId, double timestampMs, double durationMs, SpanOutcome outcome, std::optional<std::string> parentSpanId, std::string name, std::string correlationId, std::vector<TraceAttribute> attributes): sourceSpanId(sourceSpanId), sourceParentSpanId(sourceParentSpanId), timestampMs(timestampMs), durationMs(durationMs), outcome(outcome), parentSpanId(parentSpanId), name(name), correlationId(correlationId), attributes(attributes) {}
|
|
62
|
+
|
|
63
|
+
public:
|
|
64
|
+
friend bool operator==(const CompletedSpanOptions& lhs, const CompletedSpanOptions& rhs) = default;
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::nitrotracing
|
|
68
|
+
|
|
69
|
+
namespace margelo::nitro {
|
|
70
|
+
|
|
71
|
+
// C++ CompletedSpanOptions <> JS CompletedSpanOptions (object)
|
|
72
|
+
template <>
|
|
73
|
+
struct JSIConverter<margelo::nitro::nitrotracing::CompletedSpanOptions> final {
|
|
74
|
+
static inline margelo::nitro::nitrotracing::CompletedSpanOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
75
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
76
|
+
return margelo::nitro::nitrotracing::CompletedSpanOptions(
|
|
77
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceSpanId"))),
|
|
78
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceParentSpanId"))),
|
|
79
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampMs"))),
|
|
80
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs"))),
|
|
81
|
+
JSIConverter<margelo::nitro::nitrotracing::SpanOutcome>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome"))),
|
|
82
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parentSpanId"))),
|
|
83
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
84
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "correlationId"))),
|
|
85
|
+
JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributes")))
|
|
86
|
+
);
|
|
87
|
+
}
|
|
88
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrotracing::CompletedSpanOptions& arg) {
|
|
89
|
+
jsi::Object obj(runtime);
|
|
90
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceSpanId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceSpanId));
|
|
91
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sourceParentSpanId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.sourceParentSpanId));
|
|
92
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampMs"), JSIConverter<double>::toJSI(runtime, arg.timestampMs));
|
|
93
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "durationMs"), JSIConverter<double>::toJSI(runtime, arg.durationMs));
|
|
94
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "outcome"), JSIConverter<margelo::nitro::nitrotracing::SpanOutcome>::toJSI(runtime, arg.outcome));
|
|
95
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "parentSpanId"), JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.parentSpanId));
|
|
96
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
97
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "correlationId"), JSIConverter<std::string>::toJSI(runtime, arg.correlationId));
|
|
98
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "attributes"), JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::toJSI(runtime, arg.attributes));
|
|
99
|
+
return obj;
|
|
100
|
+
}
|
|
101
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
102
|
+
if (!value.isObject()) {
|
|
103
|
+
return false;
|
|
104
|
+
}
|
|
105
|
+
jsi::Object obj = value.getObject(runtime);
|
|
106
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
107
|
+
return false;
|
|
108
|
+
}
|
|
109
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceSpanId")))) return false;
|
|
110
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sourceParentSpanId")))) return false;
|
|
111
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampMs")))) return false;
|
|
112
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "durationMs")))) return false;
|
|
113
|
+
if (!JSIConverter<margelo::nitro::nitrotracing::SpanOutcome>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "outcome")))) return false;
|
|
114
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "parentSpanId")))) return false;
|
|
115
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
116
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "correlationId")))) return false;
|
|
117
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributes")))) return false;
|
|
118
|
+
return true;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
|
|
122
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRecordingSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridRecordingSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrotracing {
|
|
11
|
+
|
|
12
|
+
void HybridRecordingSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("startSpan", &HybridRecordingSpec::startSpan);
|
|
18
|
+
prototype.registerHybridMethod("recordSpan", &HybridRecordingSpec::recordSpan);
|
|
19
|
+
prototype.registerHybridMethod("mark", &HybridRecordingSpec::mark);
|
|
20
|
+
prototype.registerHybridMethod("recordMetric", &HybridRecordingSpec::recordMetric);
|
|
21
|
+
prototype.registerHybridMethod("readEvents", &HybridRecordingSpec::readEvents);
|
|
22
|
+
prototype.registerHybridMethod("getStats", &HybridRecordingSpec::getStats);
|
|
23
|
+
prototype.registerHybridMethod("stop", &HybridRecordingSpec::stop);
|
|
24
|
+
prototype.registerHybridMethod("exportJson", &HybridRecordingSpec::exportJson);
|
|
25
|
+
prototype.registerHybridMethod("exportTraceEvents", &HybridRecordingSpec::exportTraceEvents);
|
|
26
|
+
prototype.registerHybridMethod("startNativeSampling", &HybridRecordingSpec::startNativeSampling);
|
|
27
|
+
prototype.registerHybridMethod("stopNativeSampling", &HybridRecordingSpec::stopNativeSampling);
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
} // namespace margelo::nitro::nitrotracing
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridRecordingSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridTraceSpanSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitrotracing { class HybridTraceSpanSpec; }
|
|
18
|
+
// Forward declaration of `SpanOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitrotracing { struct SpanOptions; }
|
|
20
|
+
// Forward declaration of `CompletedSpanOptions` to properly resolve imports.
|
|
21
|
+
namespace margelo::nitro::nitrotracing { struct CompletedSpanOptions; }
|
|
22
|
+
// Forward declaration of `MarkOptions` to properly resolve imports.
|
|
23
|
+
namespace margelo::nitro::nitrotracing { struct MarkOptions; }
|
|
24
|
+
// Forward declaration of `MetricOptions` to properly resolve imports.
|
|
25
|
+
namespace margelo::nitro::nitrotracing { struct MetricOptions; }
|
|
26
|
+
// Forward declaration of `TracePage` to properly resolve imports.
|
|
27
|
+
namespace margelo::nitro::nitrotracing { struct TracePage; }
|
|
28
|
+
// Forward declaration of `ReadOptions` to properly resolve imports.
|
|
29
|
+
namespace margelo::nitro::nitrotracing { struct ReadOptions; }
|
|
30
|
+
// Forward declaration of `RecordingStats` to properly resolve imports.
|
|
31
|
+
namespace margelo::nitro::nitrotracing { struct RecordingStats; }
|
|
32
|
+
// Forward declaration of `NativeSamplingOptions` to properly resolve imports.
|
|
33
|
+
namespace margelo::nitro::nitrotracing { struct NativeSamplingOptions; }
|
|
34
|
+
|
|
35
|
+
#include <memory>
|
|
36
|
+
#include "HybridTraceSpanSpec.hpp"
|
|
37
|
+
#include "SpanOptions.hpp"
|
|
38
|
+
#include <string>
|
|
39
|
+
#include "CompletedSpanOptions.hpp"
|
|
40
|
+
#include "MarkOptions.hpp"
|
|
41
|
+
#include "MetricOptions.hpp"
|
|
42
|
+
#include "TracePage.hpp"
|
|
43
|
+
#include <NitroModules/Promise.hpp>
|
|
44
|
+
#include "ReadOptions.hpp"
|
|
45
|
+
#include "RecordingStats.hpp"
|
|
46
|
+
#include "NativeSamplingOptions.hpp"
|
|
47
|
+
|
|
48
|
+
namespace margelo::nitro::nitrotracing {
|
|
49
|
+
|
|
50
|
+
using namespace margelo::nitro;
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* An abstract base class for `Recording`
|
|
54
|
+
* Inherit this class to create instances of `HybridRecordingSpec` in C++.
|
|
55
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
56
|
+
* @example
|
|
57
|
+
* ```cpp
|
|
58
|
+
* class HybridRecording: public HybridRecordingSpec {
|
|
59
|
+
* public:
|
|
60
|
+
* HybridRecording(...): HybridObject(TAG) { ... }
|
|
61
|
+
* // ...
|
|
62
|
+
* };
|
|
63
|
+
* ```
|
|
64
|
+
*/
|
|
65
|
+
class HybridRecordingSpec: public virtual HybridObject {
|
|
66
|
+
public:
|
|
67
|
+
// Constructor
|
|
68
|
+
explicit HybridRecordingSpec(): HybridObject(TAG) { }
|
|
69
|
+
|
|
70
|
+
// Destructor
|
|
71
|
+
~HybridRecordingSpec() override = default;
|
|
72
|
+
|
|
73
|
+
public:
|
|
74
|
+
// Properties
|
|
75
|
+
|
|
76
|
+
|
|
77
|
+
public:
|
|
78
|
+
// Methods
|
|
79
|
+
virtual std::shared_ptr<HybridTraceSpanSpec> startSpan(const SpanOptions& options) = 0;
|
|
80
|
+
virtual std::string recordSpan(const CompletedSpanOptions& options) = 0;
|
|
81
|
+
virtual void mark(const MarkOptions& options) = 0;
|
|
82
|
+
virtual void recordMetric(const MetricOptions& options) = 0;
|
|
83
|
+
virtual std::shared_ptr<Promise<TracePage>> readEvents(const ReadOptions& options) = 0;
|
|
84
|
+
virtual RecordingStats getStats() = 0;
|
|
85
|
+
virtual void stop() = 0;
|
|
86
|
+
virtual std::shared_ptr<Promise<std::string>> exportJson() = 0;
|
|
87
|
+
virtual std::shared_ptr<Promise<std::string>> exportTraceEvents() = 0;
|
|
88
|
+
virtual void startNativeSampling(const NativeSamplingOptions& options) = 0;
|
|
89
|
+
virtual void stopNativeSampling() = 0;
|
|
90
|
+
|
|
91
|
+
protected:
|
|
92
|
+
// Hybrid Setup
|
|
93
|
+
void loadHybridMethods() override;
|
|
94
|
+
|
|
95
|
+
protected:
|
|
96
|
+
// Tag for logging
|
|
97
|
+
static constexpr auto TAG = "Recording";
|
|
98
|
+
};
|
|
99
|
+
|
|
100
|
+
} // namespace margelo::nitro::nitrotracing
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTraceSpanSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridTraceSpanSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrotracing {
|
|
11
|
+
|
|
12
|
+
void HybridTraceSpanSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridGetter("spanId", &HybridTraceSpanSpec::getSpanId);
|
|
18
|
+
prototype.registerHybridGetter("recorded", &HybridTraceSpanSpec::getRecorded);
|
|
19
|
+
prototype.registerHybridMethod("end", &HybridTraceSpanSpec::end);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
} // namespace margelo::nitro::nitrotracing
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTraceSpanSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `SpanOutcome` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitrotracing { enum class SpanOutcome; }
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include "SpanOutcome.hpp"
|
|
21
|
+
|
|
22
|
+
namespace margelo::nitro::nitrotracing {
|
|
23
|
+
|
|
24
|
+
using namespace margelo::nitro;
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* An abstract base class for `TraceSpan`
|
|
28
|
+
* Inherit this class to create instances of `HybridTraceSpanSpec` in C++.
|
|
29
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
30
|
+
* @example
|
|
31
|
+
* ```cpp
|
|
32
|
+
* class HybridTraceSpan: public HybridTraceSpanSpec {
|
|
33
|
+
* public:
|
|
34
|
+
* HybridTraceSpan(...): HybridObject(TAG) { ... }
|
|
35
|
+
* // ...
|
|
36
|
+
* };
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
class HybridTraceSpanSpec: public virtual HybridObject {
|
|
40
|
+
public:
|
|
41
|
+
// Constructor
|
|
42
|
+
explicit HybridTraceSpanSpec(): HybridObject(TAG) { }
|
|
43
|
+
|
|
44
|
+
// Destructor
|
|
45
|
+
~HybridTraceSpanSpec() override = default;
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
// Properties
|
|
49
|
+
virtual std::string getSpanId() = 0;
|
|
50
|
+
virtual bool getRecorded() = 0;
|
|
51
|
+
|
|
52
|
+
public:
|
|
53
|
+
// Methods
|
|
54
|
+
virtual void end(SpanOutcome outcome) = 0;
|
|
55
|
+
|
|
56
|
+
protected:
|
|
57
|
+
// Hybrid Setup
|
|
58
|
+
void loadHybridMethods() override;
|
|
59
|
+
|
|
60
|
+
protected:
|
|
61
|
+
// Tag for logging
|
|
62
|
+
static constexpr auto TAG = "TraceSpan";
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
} // namespace margelo::nitro::nitrotracing
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTracingSpec.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridTracingSpec.hpp"
|
|
9
|
+
|
|
10
|
+
namespace margelo::nitro::nitrotracing {
|
|
11
|
+
|
|
12
|
+
void HybridTracingSpec::loadHybridMethods() {
|
|
13
|
+
// load base methods/properties
|
|
14
|
+
HybridObject::loadHybridMethods();
|
|
15
|
+
// load custom methods/properties
|
|
16
|
+
registerHybrids(this, [](Prototype& prototype) {
|
|
17
|
+
prototype.registerHybridMethod("startRecording", &HybridTracingSpec::startRecording);
|
|
18
|
+
prototype.registerHybridMethod("disableHermesSampling", &HybridTracingSpec::disableHermesSampling);
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
} // namespace margelo::nitro::nitrotracing
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridTracingSpec.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/HybridObject.hpp>)
|
|
11
|
+
#include <NitroModules/HybridObject.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
|
|
16
|
+
// Forward declaration of `HybridRecordingSpec` to properly resolve imports.
|
|
17
|
+
namespace margelo::nitro::nitrotracing { class HybridRecordingSpec; }
|
|
18
|
+
// Forward declaration of `RecordingOptions` to properly resolve imports.
|
|
19
|
+
namespace margelo::nitro::nitrotracing { struct RecordingOptions; }
|
|
20
|
+
|
|
21
|
+
#include <memory>
|
|
22
|
+
#include "HybridRecordingSpec.hpp"
|
|
23
|
+
#include "RecordingOptions.hpp"
|
|
24
|
+
|
|
25
|
+
namespace margelo::nitro::nitrotracing {
|
|
26
|
+
|
|
27
|
+
using namespace margelo::nitro;
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* An abstract base class for `Tracing`
|
|
31
|
+
* Inherit this class to create instances of `HybridTracingSpec` in C++.
|
|
32
|
+
* You must explicitly call `HybridObject`'s constructor yourself, because it is virtual.
|
|
33
|
+
* @example
|
|
34
|
+
* ```cpp
|
|
35
|
+
* class HybridTracing: public HybridTracingSpec {
|
|
36
|
+
* public:
|
|
37
|
+
* HybridTracing(...): HybridObject(TAG) { ... }
|
|
38
|
+
* // ...
|
|
39
|
+
* };
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
class HybridTracingSpec: public virtual HybridObject {
|
|
43
|
+
public:
|
|
44
|
+
// Constructor
|
|
45
|
+
explicit HybridTracingSpec(): HybridObject(TAG) { }
|
|
46
|
+
|
|
47
|
+
// Destructor
|
|
48
|
+
~HybridTracingSpec() override = default;
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
// Properties
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
public:
|
|
55
|
+
// Methods
|
|
56
|
+
virtual std::shared_ptr<HybridRecordingSpec> startRecording(const RecordingOptions& options) = 0;
|
|
57
|
+
virtual bool disableHermesSampling() = 0;
|
|
58
|
+
|
|
59
|
+
protected:
|
|
60
|
+
// Hybrid Setup
|
|
61
|
+
void loadHybridMethods() override;
|
|
62
|
+
|
|
63
|
+
protected:
|
|
64
|
+
// Tag for logging
|
|
65
|
+
static constexpr auto TAG = "Tracing";
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
} // namespace margelo::nitro::nitrotracing
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MarkEvent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `TraceAttribute` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrotracing { struct TraceAttribute; }
|
|
33
|
+
|
|
34
|
+
#include <string>
|
|
35
|
+
#include "TraceAttribute.hpp"
|
|
36
|
+
#include <vector>
|
|
37
|
+
|
|
38
|
+
namespace margelo::nitro::nitrotracing {
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* A struct which can be represented as a JavaScript object (MarkEvent).
|
|
42
|
+
*/
|
|
43
|
+
struct MarkEvent final {
|
|
44
|
+
public:
|
|
45
|
+
double sequence SWIFT_PRIVATE;
|
|
46
|
+
double timestampMs SWIFT_PRIVATE;
|
|
47
|
+
std::string name SWIFT_PRIVATE;
|
|
48
|
+
std::string correlationId SWIFT_PRIVATE;
|
|
49
|
+
std::vector<TraceAttribute> attributes SWIFT_PRIVATE;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
MarkEvent() = default;
|
|
53
|
+
explicit MarkEvent(double sequence, double timestampMs, std::string name, std::string correlationId, std::vector<TraceAttribute> attributes): sequence(sequence), timestampMs(timestampMs), name(name), correlationId(correlationId), attributes(attributes) {}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
friend bool operator==(const MarkEvent& lhs, const MarkEvent& rhs) = default;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::nitrotracing
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ MarkEvent <> JS MarkEvent (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::nitrotracing::MarkEvent> final {
|
|
66
|
+
static inline margelo::nitro::nitrotracing::MarkEvent fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::nitrotracing::MarkEvent(
|
|
69
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequence"))),
|
|
70
|
+
JSIConverter<double>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampMs"))),
|
|
71
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
72
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "correlationId"))),
|
|
73
|
+
JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributes")))
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrotracing::MarkEvent& arg) {
|
|
77
|
+
jsi::Object obj(runtime);
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "sequence"), JSIConverter<double>::toJSI(runtime, arg.sequence));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampMs"), JSIConverter<double>::toJSI(runtime, arg.timestampMs));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
81
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "correlationId"), JSIConverter<std::string>::toJSI(runtime, arg.correlationId));
|
|
82
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "attributes"), JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::toJSI(runtime, arg.attributes));
|
|
83
|
+
return obj;
|
|
84
|
+
}
|
|
85
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
86
|
+
if (!value.isObject()) {
|
|
87
|
+
return false;
|
|
88
|
+
}
|
|
89
|
+
jsi::Object obj = value.getObject(runtime);
|
|
90
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "sequence")))) return false;
|
|
94
|
+
if (!JSIConverter<double>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampMs")))) return false;
|
|
95
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
96
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "correlationId")))) return false;
|
|
97
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributes")))) return false;
|
|
98
|
+
return true;
|
|
99
|
+
}
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// MarkOptions.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
11
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
16
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/JSIHelpers.hpp>)
|
|
21
|
+
#include <NitroModules/JSIHelpers.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
#if __has_include(<NitroModules/PropNameIDCache.hpp>)
|
|
26
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
27
|
+
#else
|
|
28
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
29
|
+
#endif
|
|
30
|
+
|
|
31
|
+
// Forward declaration of `TraceAttribute` to properly resolve imports.
|
|
32
|
+
namespace margelo::nitro::nitrotracing { struct TraceAttribute; }
|
|
33
|
+
|
|
34
|
+
#include <optional>
|
|
35
|
+
#include <string>
|
|
36
|
+
#include "TraceAttribute.hpp"
|
|
37
|
+
#include <vector>
|
|
38
|
+
|
|
39
|
+
namespace margelo::nitro::nitrotracing {
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* A struct which can be represented as a JavaScript object (MarkOptions).
|
|
43
|
+
*/
|
|
44
|
+
struct MarkOptions final {
|
|
45
|
+
public:
|
|
46
|
+
std::optional<double> timestampMs SWIFT_PRIVATE;
|
|
47
|
+
std::string name SWIFT_PRIVATE;
|
|
48
|
+
std::string correlationId SWIFT_PRIVATE;
|
|
49
|
+
std::vector<TraceAttribute> attributes SWIFT_PRIVATE;
|
|
50
|
+
|
|
51
|
+
public:
|
|
52
|
+
MarkOptions() = default;
|
|
53
|
+
explicit MarkOptions(std::optional<double> timestampMs, std::string name, std::string correlationId, std::vector<TraceAttribute> attributes): timestampMs(timestampMs), name(name), correlationId(correlationId), attributes(attributes) {}
|
|
54
|
+
|
|
55
|
+
public:
|
|
56
|
+
friend bool operator==(const MarkOptions& lhs, const MarkOptions& rhs) = default;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
} // namespace margelo::nitro::nitrotracing
|
|
60
|
+
|
|
61
|
+
namespace margelo::nitro {
|
|
62
|
+
|
|
63
|
+
// C++ MarkOptions <> JS MarkOptions (object)
|
|
64
|
+
template <>
|
|
65
|
+
struct JSIConverter<margelo::nitro::nitrotracing::MarkOptions> final {
|
|
66
|
+
static inline margelo::nitro::nitrotracing::MarkOptions fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
67
|
+
jsi::Object obj = arg.asObject(runtime);
|
|
68
|
+
return margelo::nitro::nitrotracing::MarkOptions(
|
|
69
|
+
JSIConverter<std::optional<double>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampMs"))),
|
|
70
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name"))),
|
|
71
|
+
JSIConverter<std::string>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "correlationId"))),
|
|
72
|
+
JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::fromJSI(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributes")))
|
|
73
|
+
);
|
|
74
|
+
}
|
|
75
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::nitrotracing::MarkOptions& arg) {
|
|
76
|
+
jsi::Object obj(runtime);
|
|
77
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "timestampMs"), JSIConverter<std::optional<double>>::toJSI(runtime, arg.timestampMs));
|
|
78
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "name"), JSIConverter<std::string>::toJSI(runtime, arg.name));
|
|
79
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "correlationId"), JSIConverter<std::string>::toJSI(runtime, arg.correlationId));
|
|
80
|
+
obj.setProperty(runtime, PropNameIDCache::get(runtime, "attributes"), JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::toJSI(runtime, arg.attributes));
|
|
81
|
+
return obj;
|
|
82
|
+
}
|
|
83
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
84
|
+
if (!value.isObject()) {
|
|
85
|
+
return false;
|
|
86
|
+
}
|
|
87
|
+
jsi::Object obj = value.getObject(runtime);
|
|
88
|
+
if (!nitro::isPlainObject(runtime, obj)) {
|
|
89
|
+
return false;
|
|
90
|
+
}
|
|
91
|
+
if (!JSIConverter<std::optional<double>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "timestampMs")))) return false;
|
|
92
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "name")))) return false;
|
|
93
|
+
if (!JSIConverter<std::string>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "correlationId")))) return false;
|
|
94
|
+
if (!JSIConverter<std::vector<margelo::nitro::nitrotracing::TraceAttribute>>::canConvert(runtime, obj.getProperty(runtime, PropNameIDCache::get(runtime, "attributes")))) return false;
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
} // namespace margelo::nitro
|