Skip to content

Commit 9513f13

Browse files
move non-generic Session Info members into an "extras" map
Reviewed By: jdelliot Differential Revision: D74839393 fbshipit-source-id: 7e87bcd50ca79530928c4a3b4133e8b6c311f9c4
1 parent b1d0a11 commit 9513f13

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

third-party/watchman/src/watchman/telemetry/WatchmanStructuredLogger.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,28 @@ std::shared_ptr<StructuredLogger> getLogger() {
3636
DynamicEvent WatchmanStructuredLogger::populateDefaultFields(
3737
std::optional<const char*> type) {
3838
DynamicEvent event = StructuredLogger::populateDefaultFields(type);
39-
if (sessionInfo_.ciInstanceId.has_value()) {
40-
event.addInt("sandcastle_instance_id", *sessionInfo_.ciInstanceId);
41-
}
4239
event.addString("version", sessionInfo_.appVersion);
4340
#ifdef WATCHMAN_BUILD_INFO
4441
event.addString("buildinfo", WATCHMAN_BUILD_INFO);
4542
#endif
4643
event.addString("logged_by", "watchman");
44+
45+
const auto& fbInfo = sessionInfo_.fbInfo;
46+
for (const auto& info : fbInfo) {
47+
const auto& key = info.first;
48+
const auto& value = info.second;
49+
std::visit(
50+
[&](const auto& v) {
51+
using T = std::decay_t<decltype(v)>;
52+
if constexpr (std::is_same_v<T, std::string>) {
53+
event.addString(key, v);
54+
} else if constexpr (std::is_same_v<T, uint64_t>) {
55+
event.addInt(key, v);
56+
}
57+
},
58+
value);
59+
}
60+
4761
return event;
4862
}
4963

0 commit comments

Comments
 (0)