We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cb2207f commit 688525fCopy full SHA for 688525f
observe-api/cxx/observe_api.hpp
@@ -28,9 +28,17 @@ void statsd(std::string_view mtc);
28
void span_tags(std::vector<std::string> &tags);
29
30
class Span {
31
+ bool ended;
32
+
33
public:
- Span(std::string_view name) { span_enter(name); }
- ~Span() { span_exit(); }
34
+ Span(std::string_view name) : ended(false) { span_enter(name); }
35
+ void end() {
36
+ if (!ended) {
37
+ ended = true;
38
+ span_exit();
39
+ }
40
41
+ ~Span() { end(); }
42
void metric(enum DO_METRIC_FMT format, std::string_view mtc) {
43
observe_api::metric(format, mtc);
44
}
observe-api/test/cxx_guest_3.wasm
150 Bytes
0 commit comments