Skip to content

Commit 61e8af3

Browse files
split tele env from project env
1 parent 1922535 commit 61e8af3

168 files changed

Lines changed: 700 additions & 779 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎aether/access_points/modem_access_point.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
#if AE_SUPPORT_MODEMS
1919

2020
# include "aether/aether.h"
21-
# include "aether/server.h"
2221
# include "aether/modems/imodem_driver.h"
22+
# include "aether/server.h"
2323

24-
# include "aether/channels/modem_channel.h"
2524
# include "aether/access_points/filter_endpoints.h"
25+
# include "aether/channels/modem_channel.h"
2626

27-
# include "aether/tele/tele.h"
27+
# include "aether/tele.h"
2828

2929
namespace ae {
3030
ModemConnectAction::ModemConnectAction(AeContext const& ae_context,

‎aether/access_points/wifi_access_point.cpp‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,15 @@
1919
#if AE_SUPPORT_WIFIS
2020
# include <utility>
2121

22-
# include "aether/aether.h"
23-
# include "aether/server.h"
24-
# include "aether/poller/poller.h"
25-
# include "aether/dns/dns_resolve.h"
22+
# include "aether/access_points/filter_endpoints.h"
2623
# include "aether/adapters/wifi_adapter.h"
24+
# include "aether/aether.h"
2725
# include "aether/channels/wifi_channel.h"
28-
# include "aether/access_points/filter_endpoints.h"
26+
# include "aether/dns/dns_resolve.h"
27+
# include "aether/poller/poller.h"
28+
# include "aether/server.h"
2929

30-
# include "aether/tele/tele.h"
30+
# include "aether/tele.h"
3131

3232
namespace ae {
3333

@@ -53,7 +53,8 @@ WifiConnectAction::connection_event() {
5353

5454
void WifiConnectAction::EnsureConnected() {
5555
auto connected_to = driver_->connected_to();
56-
AE_TELED_DEBUG("Driver connected to {}", connected_to.value_or("NOT CONNECTED"));
56+
AE_TELED_DEBUG("Driver connected to {}",
57+
connected_to.value_or("NOT CONNECTED"));
5758
// if already connected
5859
if (connected_to && (*connected_to == wifi_ap_.creds.ssid)) {
5960
SetConnected(true);

‎aether/adapters/adapter_tele.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef AETHER_ADAPTERS_ADAPTER_TELE_H_
1818
#define AETHER_ADAPTERS_ADAPTER_TELE_H_
1919

20-
#include "aether/tele/tele.h"
20+
#include "aether/tele.h"
2121

2222
AE_TELE_MODULE(kAdapter, 5, 101, 121);
2323
AE_TAG(kEthernetAdapterCreate, kAdapter)

‎aether/adapters/wifi_adapter.cpp‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@
1818

1919
#if AE_SUPPORT_WIFIS
2020

21-
# include <utility>
2221
# include <cassert>
22+
# include <utility>
2323

2424
# include "aether/aether.h"
25-
# include "aether/poller/poller.h"
2625
# include "aether/dns/dns_resolve.h"
26+
# include "aether/poller/poller.h"
2727
# include "aether/wifi/wifi_driver_factory.h"
2828

29-
# include "aether/tele/tele.h"
29+
# include "aether/tele.h"
3030

3131
namespace ae {
3232
# if defined AE_DISTILLATION

‎aether/ae_actions/ae_actions_tele.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#ifndef AETHER_AE_ACTIONS_AE_ACTIONS_TELE_H_
1818
#define AETHER_AE_ACTIONS_AE_ACTIONS_TELE_H_
1919

20-
#include "aether/tele/tele.h"
20+
#include "aether/tele.h"
2121

2222
#if AE_SUPPORT_REGISTRATION
2323
AE_TELE_MODULE(kRegister, 1000, 1000, 1050);

‎aether/ae_actions/telemetry.cpp‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
# include "aether-miscpp/format/format.h"
2222
# include "aether/aether.h"
23-
# include "aether/tele/tele.h"
23+
# include "aether/tele.h"
2424
# include "aether/tele/traps/tele_statistics.h"
2525

2626
# include "aether/mstream.h"

‎aether/aether_app.cpp‎

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,13 +37,14 @@
3737

3838
#include "aether/tele/tele_init.h"
3939

40-
#include "aether/aether_tele.h"
40+
#include "aether/tele.h"
41+
#include "aether/tele_compile_options.h"
4142

4243
namespace ae {
4344

4445
AetherAppContext::TelemetryInit::TelemetryInit() {
4546
tele::TeleInit::Init();
46-
AE_TELE_ENV();
47+
AE_TELE_ENV(kCompileOptions);
4748
AE_TELE_INFO(AetherStarted);
4849
Registry::GetRegistry().Log();
4950
}

‎aether/aether_tele.h‎

Lines changed: 93 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,100 @@
1717
#ifndef AETHER_AETHER_TELE_H_
1818
#define AETHER_AETHER_TELE_H_
1919

20-
#include "aether/tele/tele.h"
20+
#include <cstdint>
2121

22+
#include "aether/config.h"
23+
#include "aether/tele/levels.h"
24+
#include "aether/tele/tags.h"
25+
26+
namespace ae {
27+
namespace aether_tele_internal {
28+
template <auto flag>
29+
constexpr bool IsEnabled(std::initializer_list<decltype(flag)> list) {
30+
for (auto v : list) {
31+
if (flag == v) {
32+
return true;
33+
}
34+
}
35+
return false;
36+
}
37+
38+
template <auto flag>
39+
constexpr bool IsEnabled(decltype(flag) value) {
40+
return (flag == value);
41+
}
42+
43+
template <typename T>
44+
constexpr bool IsAll(T const value) {
45+
return value == static_cast<T>(AE_ALL);
46+
}
47+
template <typename T, std::size_t Size>
48+
constexpr bool IsAll(T const (& /* value */)[Size]) { // NOLINT(*c-arrays)
49+
return false;
50+
}
51+
} // namespace aether_tele_internal
52+
53+
// NOLINTBEGIN
54+
// OPTION equals to AE_ALL or MODULE in OPTION list and not in OPTION_EXCLUDE
55+
// list
56+
#define _AE_MODULE_CONFIG(MODULE, OPTION) \
57+
(((aether_tele_internal::IsAll(OPTION) && \
58+
!aether_tele_internal::IsEnabled<MODULE>(OPTION##_EXCLUDE)) || \
59+
aether_tele_internal::IsEnabled<MODULE>(OPTION)))
60+
61+
#define _AE_LEVEL_MODULE_CONFIG(MODULE, LEVEL) \
62+
(LEVEL == ae::tele::Level::kDebug \
63+
? _AE_MODULE_CONFIG(MODULE, AE_TELE_DEBUG_MODULES) \
64+
: (LEVEL == ae::tele::Level::kInfo \
65+
? _AE_MODULE_CONFIG(MODULE, AE_TELE_INFO_MODULES) \
66+
: (LEVEL == ae::tele::Level::kWarning \
67+
? _AE_MODULE_CONFIG(MODULE, AE_TELE_WARN_MODULES) \
68+
: /* ae::tele::Level::kError */ _AE_MODULE_CONFIG( \
69+
MODULE, AE_TELE_ERROR_MODULES))))
70+
// NOLINTEND
71+
72+
struct AetherTeleConfig {
73+
template <tele::Level::underlined_t L, std::uint32_t M>
74+
struct TeleConfig {
75+
// IF the whole Level + Module enabled
76+
static constexpr bool kTeleEnabled =
77+
AE_TELE_ENABLED && _AE_LEVEL_MODULE_CONFIG(L, M);
78+
static constexpr bool kLogsEnabled =
79+
kTeleEnabled && _AE_MODULE_CONFIG(M, AE_TELE_LOG_MODULES);
80+
81+
// count must be always enabled if metrics enabled
82+
static constexpr bool kCountMetrics =
83+
kTeleEnabled && _AE_MODULE_CONFIG(M, AE_TELE_METRICS_MODULES);
84+
// time metrics
85+
static constexpr bool kTimeMetrics =
86+
kTeleEnabled && _AE_MODULE_CONFIG(M, AE_TELE_METRICS_MODULES) &&
87+
_AE_MODULE_CONFIG(M, AE_TELE_METRICS_DURATION);
88+
89+
// start time
90+
static constexpr bool kStartTimeLogs =
91+
kLogsEnabled && _AE_MODULE_CONFIG(M, AE_TELE_LOG_TIME_POINT);
92+
// level and module
93+
static constexpr bool kLevelModuleLogs =
94+
kLogsEnabled && _AE_MODULE_CONFIG(M, AE_TELE_LOG_LEVEL_MODULE);
95+
// location
96+
static constexpr bool kLocationLogs =
97+
kLogsEnabled && _AE_MODULE_CONFIG(M, AE_TELE_LOG_LOCATION);
98+
// name
99+
static constexpr bool kNameLogs =
100+
kLogsEnabled && _AE_MODULE_CONFIG(M, AE_TELE_LOG_NAME);
101+
// blob
102+
static constexpr bool kBlobLogs =
103+
kLogsEnabled && _AE_MODULE_CONFIG(M, AE_TELE_LOG_BLOB);
104+
};
105+
106+
struct EnvConfig {
107+
static constexpr bool kStaticInfo = AE_TELE_COMPILATION_INFO;
108+
static constexpr bool kRuntimeInfo = AE_TELE_RUNTIME_INFO;
109+
};
110+
};
111+
} // namespace ae
112+
113+
// Main module for aether and tags
22114
AE_TELE_MODULE(kAether, 2, 3, 5);
23115
AE_TAG(AetherStarted, kAether)
24116
AE_TAG(AetherCreated, kAether)

‎aether/all.h‎

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -18,99 +18,99 @@
1818
#define AETHER_ALL_H_
1919

2020
// IWYU pragma: begin_exports
21-
#include "aether/config.h"
22-
#include "aether/common.h"
23-
#include "aether/memory.h"
2421
#include "aether/ae_context.h"
2522
#include "aether/aether_app.h"
23+
#include "aether/common.h"
24+
#include "aether/config.h"
25+
#include "aether/memory.h"
2626

27-
#include "aether/executors/executors.h"
2827
#include "aether/actions/action_context.h"
2928
#include "aether/actions/repeatable_task.h"
30-
#include "aether/events/events.h"
3129
#include "aether/events/cumulative_event.h"
3230
#include "aether/events/event_subscription.h"
31+
#include "aether/events/events.h"
3332
#include "aether/events/multi_subscription.h"
33+
#include "aether/executors/executors.h"
3434

3535
#include "aether-miscpp/format/format.h"
3636
#include "aether-miscpp/reflect/reflect.h"
37-
#include "aether/ptr/ptr.h"
38-
#include "aether/ptr/rc_ptr.h"
39-
#include "aether/ptr/ptr_view.h"
37+
#include "aether/obj/domain.h"
4038
#include "aether/obj/obj.h"
4139
#include "aether/obj/obj_id.h"
42-
#include "aether/obj/domain.h"
4340
#include "aether/obj/obj_ptr.h"
4441
#include "aether/obj/registry.h"
42+
#include "aether/ptr/ptr.h"
43+
#include "aether/ptr/ptr_view.h"
44+
#include "aether/ptr/rc_ptr.h"
4545

4646
#include "aether/tele/tele_init.h"
4747

48-
#include "aether/domain_storage/ram_domain_storage.h"
49-
#include "aether/domain_storage/spifs_domain_storage.h"
50-
#include "aether/domain_storage/static_domain_storage.h"
5148
#include "aether/domain_storage/domain_storage_factory.h"
5249
#include "aether/domain_storage/file_system_std_storage.h"
50+
#include "aether/domain_storage/ram_domain_storage.h"
5351
#include "aether/domain_storage/registrar_domain_storage.h"
52+
#include "aether/domain_storage/spifs_domain_storage.h"
53+
#include "aether/domain_storage/static_domain_storage.h"
5454

55-
#include "aether/types/uid.h"
56-
#include "aether/types/span.h"
5755
#include "aether/types/address.h"
58-
#include "aether/types/static_map.h"
59-
#include "aether/types/server_id.h"
56+
#include "aether/types/address_parser.h"
57+
#include "aether/types/client_config.h"
6058
#include "aether/types/client_id.h"
61-
#include "aether/types/ring_index.h"
6259
#include "aether/types/data_buffer.h"
63-
#include "aether/types/client_config.h"
64-
#include "aether/types/server_config.h"
65-
#include "aether/types/state_machine.h"
6660
#include "aether/types/literal_array.h"
6761
#include "aether/types/nullable_type.h"
68-
#include "aether/types/address_parser.h"
62+
#include "aether/types/ring_index.h"
63+
#include "aether/types/server_config.h"
64+
#include "aether/types/server_id.h"
65+
#include "aether/types/span.h"
66+
#include "aether/types/state_machine.h"
67+
#include "aether/types/static_map.h"
68+
#include "aether/types/uid.h"
6969

70-
#include "aether/stream_api/istream.h"
7170
#include "aether/stream_api/api_call_adapter.h"
72-
#include "aether/write_action/write_action.h"
71+
#include "aether/stream_api/istream.h"
7372
#include "aether/write_action/buffer_write.h"
74-
#include "aether/write_action/failed_write_action.h"
7573
#include "aether/write_action/done_write_action.h"
74+
#include "aether/write_action/failed_write_action.h"
75+
#include "aether/write_action/write_action.h"
7676

7777
#include "aether/serial_ports/iserial_port.h"
78-
#include "aether/serial_ports/serial_port_types.h"
7978
#include "aether/serial_ports/serial_port_factory.h"
79+
#include "aether/serial_ports/serial_port_types.h"
8080

8181
#include "aether/gateway_api/gateway_api.h"
8282
#include "aether/gateway_api/server_endpoints.h"
8383

8484
#include "aether/adapter_registry.h"
8585

8686
#include "aether/adapters/ethernet.h"
87-
#include "aether/adapters/wifi_adapter.h"
88-
#include "aether/adapters/modem_adapter.h"
8987
#include "aether/adapters/lora_module_adapter.h"
88+
#include "aether/adapters/modem_adapter.h"
89+
#include "aether/adapters/wifi_adapter.h"
9090

91-
#include "aether/ae_actions/ping.h"
92-
#include "aether/ae_actions/telemetry.h"
91+
#include "aether/ae_actions/check_access_for_send_message.h"
9392
#include "aether/ae_actions/get_servers.h"
93+
#include "aether/ae_actions/ping.h"
9494
#include "aether/ae_actions/select_client.h"
95-
#include "aether/ae_actions/check_access_for_send_message.h"
95+
#include "aether/ae_actions/telemetry.h"
9696

9797
#include "aether/modems/imodem_driver.h"
9898
#include "aether/modems/modem_factory.h"
9999

100-
#include "aether/global_ids.h"
101100
#include "aether/aether.h"
101+
#include "aether/channels/channel.h"
102102
#include "aether/client.h"
103103
#include "aether/client_connectivity_policy.h"
104-
#include "aether/server.h"
105-
#include "aether/channels/channel.h"
106-
#include "aether/crypto.h"
107-
#include "aether/cloud.h"
108-
#include "aether/work_cloud.h"
109-
#include "aether/registration_cloud.h"
110104
#include "aether/client_messages/p2p_message_stream.h"
111105
#include "aether/client_messages/p2p_safe_message_stream.h"
106+
#include "aether/cloud.h"
107+
#include "aether/crypto.h"
108+
#include "aether/global_ids.h"
109+
#include "aether/registration_cloud.h"
110+
#include "aether/server.h"
111+
#include "aether/work_cloud.h"
112112

113-
#include "aether/tele/tele.h"
113+
#include "aether/tele.h"
114114
// IWYU pragma: end_exports
115115

116116
#endif // AETHER_ALL_H_

‎aether/api_protocol/api_class_impl.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
#include "aether-miscpp/reflect/reflect.h"
2121
#include "aether/api_protocol/api_class.h"
2222
#include "aether/api_protocol/api_pack_parser.h"
23-
#include "aether/tele/tele.h"
23+
#include "aether/tele.h"
2424

2525
namespace ae {
2626
/**

0 commit comments

Comments
 (0)