Skip to content

Commit 41dafc1

Browse files
added roadmap links (#97)
1 parent 20f6f39 commit 41dafc1

File tree

3 files changed

+107
-4
lines changed

3 files changed

+107
-4
lines changed

README.md

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ TurboMqtt is written on top of [Akka.NET](https://getakka.net/) and Akka.Streams
99
## Key Features
1010

1111
* MQTT 3.1.1 support;
12-
* Extremely high performance;
12+
* Extremely high performance - hundreds of thousands of messages per second;
1313
* Extremely resource-efficient - pools memory and leverages asynchronous I/O best practices;
1414
* Extremely robust fault tolerance - this is one of [Akka.NET's great strengths](https://petabridge.com/blog/akkadotnet-actors-restart/) and we've leveraged it in TurboMqtt;
1515
* Supports all MQTT quality of service levels, with automatic publishing retries for QoS 1 and 2;
@@ -21,6 +21,15 @@ TurboMqtt is written on top of [Akka.NET](https://getakka.net/) and Akka.Streams
2121

2222
Simple interface that works at very high rates of speed with minimal resource utilization.
2323

24+
## Documentation
25+
26+
1. [QuickStart](https://github.com/petabridge/TurboMqtt/tree/dev?tab=readme-ov-file#quickstart)
27+
2. [Performance](https://github.com/petabridge/TurboMqtt/blob/dev/docs/Performance.md)
28+
3. [OpenTelemetry Support](https://github.com/petabridge/TurboMqtt/blob/dev/docs/Telemetry.md)
29+
4. [MQTT 3.1.1 Roadmap](https://github.com/petabridge/TurboMqtt/issues/66)
30+
5. [MQTT 5.0 Roadmap](https://github.com/petabridge/TurboMqtt/issues/67)
31+
6. [MQTT over Quic Roadmap](https://github.com/petabridge/TurboMqtt/issues/68)
32+
2433
## QuickStart
2534

2635
To get started with TurboMqtt:
@@ -149,5 +158,4 @@ You can purchase a license and read our full commerical license terms here: [htt
149158

150159
To get support with TurboMqtt, either fill out the help form on Sdkbin or [file an issue on the TurboMqtt repository](https://github.com/petabridge/TurboMqtt/issues).
151160

152-
TurboMqtt developed and maintained by [Petabridge](https://petabridge.com/), the company behind Akka.NET.
153-
161+
TurboMqtt developed and maintained by [Petabridge](https://petabridge.com/), the company behind Akka.NET.

docs/Telemetry.md

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
# TurboMqtt Telemetry
2+
3+
TurboMqtt supports [OpenTelemetry](https://opentelemetry.io/) - this page explains how to enable it.
4+
5+
## Subscribing to TurboMqtt `Meter` and `ActivitySource`
6+
7+
We provide some helpful extension methods to be used alongside the `OpenTelemetryBuilder` type:
8+
9+
* `AddTurboMqttMetrics()` - subscribes to all TurboMqtt metric sources.
10+
* `AddTurboMqttTracing()` - subscribes to all TurboMqtt trace sources, which we currently do not support.
11+
12+
An end to end example of how to use these settings:
13+
14+
```csharp
15+
var builder = new HostBuilder();
16+
17+
builder
18+
.ConfigureAppConfiguration(configBuilder =>
19+
{
20+
configBuilder
21+
.AddJsonFile("appsettings.json", optional: false);
22+
})
23+
.ConfigureLogging(logging =>
24+
{
25+
logging.ClearProviders();
26+
logging.AddConsole();
27+
})
28+
.ConfigureServices(s =>
29+
{
30+
// parse MqttConfig from appsettings.json
31+
var optionsBuilder = s.AddOptions<MqttConfig>();
32+
optionsBuilder.BindConfiguration("MqttConfig");
33+
s.AddTurboMqttClientFactory();
34+
35+
var resourceBuilder = ResourceBuilder.CreateDefault().AddService("DevNullConsumer",
36+
"TurboMqtt.Examples",
37+
serviceInstanceId: Dns.GetHostName());
38+
39+
s.AddOpenTelemetry()
40+
.WithMetrics(m =>
41+
{
42+
m
43+
.SetResourceBuilder(resourceBuilder)
44+
.AddTurboMqttMetrics()
45+
.AddOtlpExporter(options =>
46+
{
47+
options.Endpoint = new Uri("http://localhost:4317"); // Replace with the appropriate endpoint
48+
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc; // or HttpProtobuf
49+
});
50+
})
51+
.WithTracing(t =>
52+
{
53+
t
54+
.SetResourceBuilder(resourceBuilder)
55+
.AddTurboMqttTracing()
56+
.AddOtlpExporter(options =>
57+
{
58+
options.Endpoint = new Uri("http://localhost:4317"); // Replace with the appropriate endpoint
59+
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc; // or HttpProtobuf
60+
});
61+
});
62+
s.AddHostedService<MqttConsumerService>();
63+
});
64+
65+
var host = builder.Build();
66+
67+
await host.RunAsync();
68+
```
69+
70+
## Collected Metrics
71+
72+
What metrics does TurboMqtt expose?
73+
74+
* `recv_messages` - by `clientId`, `PacketType`, `MqttProtocolVersion`
75+
* `recv_bytes` - by `clientId`, `MqttProtocolVersion`
76+
* `sent_messages` - by `clientId`, `PacketType`, `MqttProtocolVersion`
77+
* `sent_bytes` - by `clientId`, `MqttProtocolVersion`
78+
79+
## Disabling TurboMqtt OpenTelemetry for Performance Reasons
80+
81+
If you want to disable the low-level emission of OpenTelemetry metrics and traces, we support that on the `MqttClientConnectOptions` class you have to use when creating an `IMqttClient`:
82+
83+
```csharp
84+
var tcpClientOptions = new MqttClientTcpOptions(config.Host, config.Port);
85+
var clientConnectOptions = new MqttClientConnectOptions(config.ClientId, MqttProtocolVersion.V3_1_1)
86+
{
87+
UserName = config.User,
88+
Password = config.Password,
89+
KeepAliveSeconds = 5,
90+
EnableOpenTelemetry = false // disable telemetry
91+
};
92+
93+
var client = await _clientFactory.CreateTcpClient(clientConnectOptions, tcpClientOptions);
94+
```

samples/TurboMqtt.Samples.DevNullConsumer/MqttConsumerService.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
3939
{
4040
UserName = config.User,
4141
Password = config.Password,
42-
KeepAliveSeconds = 5
42+
KeepAliveSeconds = 5,
43+
EnableOpenTelemetry = false // disable telemetry
4344
};
4445

4546
var client = await _clientFactory.CreateTcpClient(clientConnectOptions, tcpClientOptions);

0 commit comments

Comments
 (0)