Skip to content

Commit

Permalink
added roadmap links (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb authored May 1, 2024
1 parent 20f6f39 commit 41dafc1
Show file tree
Hide file tree
Showing 3 changed files with 107 additions and 4 deletions.
14 changes: 11 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ TurboMqtt is written on top of [Akka.NET](https://getakka.net/) and Akka.Streams
## Key Features

* MQTT 3.1.1 support;
* Extremely high performance;
* Extremely high performance - hundreds of thousands of messages per second;
* Extremely resource-efficient - pools memory and leverages asynchronous I/O best practices;
* 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;
* Supports all MQTT quality of service levels, with automatic publishing retries for QoS 1 and 2;
Expand All @@ -21,6 +21,15 @@ TurboMqtt is written on top of [Akka.NET](https://getakka.net/) and Akka.Streams

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

## Documentation

1. [QuickStart](https://github.com/petabridge/TurboMqtt/tree/dev?tab=readme-ov-file#quickstart)
2. [Performance](https://github.com/petabridge/TurboMqtt/blob/dev/docs/Performance.md)
3. [OpenTelemetry Support](https://github.com/petabridge/TurboMqtt/blob/dev/docs/Telemetry.md)
4. [MQTT 3.1.1 Roadmap](https://github.com/petabridge/TurboMqtt/issues/66)
5. [MQTT 5.0 Roadmap](https://github.com/petabridge/TurboMqtt/issues/67)
6. [MQTT over Quic Roadmap](https://github.com/petabridge/TurboMqtt/issues/68)

## QuickStart

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

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).

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

TurboMqtt developed and maintained by [Petabridge](https://petabridge.com/), the company behind Akka.NET.
94 changes: 94 additions & 0 deletions docs/Telemetry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# TurboMqtt Telemetry

TurboMqtt supports [OpenTelemetry](https://opentelemetry.io/) - this page explains how to enable it.

## Subscribing to TurboMqtt `Meter` and `ActivitySource`

We provide some helpful extension methods to be used alongside the `OpenTelemetryBuilder` type:

* `AddTurboMqttMetrics()` - subscribes to all TurboMqtt metric sources.
* `AddTurboMqttTracing()` - subscribes to all TurboMqtt trace sources, which we currently do not support.

An end to end example of how to use these settings:

```csharp
var builder = new HostBuilder();

builder
.ConfigureAppConfiguration(configBuilder =>
{
configBuilder
.AddJsonFile("appsettings.json", optional: false);
})
.ConfigureLogging(logging =>
{
logging.ClearProviders();
logging.AddConsole();
})
.ConfigureServices(s =>
{
// parse MqttConfig from appsettings.json
var optionsBuilder = s.AddOptions<MqttConfig>();
optionsBuilder.BindConfiguration("MqttConfig");
s.AddTurboMqttClientFactory();

var resourceBuilder = ResourceBuilder.CreateDefault().AddService("DevNullConsumer",
"TurboMqtt.Examples",
serviceInstanceId: Dns.GetHostName());

s.AddOpenTelemetry()
.WithMetrics(m =>
{
m
.SetResourceBuilder(resourceBuilder)
.AddTurboMqttMetrics()
.AddOtlpExporter(options =>
{
options.Endpoint = new Uri("http://localhost:4317"); // Replace with the appropriate endpoint
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc; // or HttpProtobuf
});
})
.WithTracing(t =>
{
t
.SetResourceBuilder(resourceBuilder)
.AddTurboMqttTracing()
.AddOtlpExporter(options =>
{
options.Endpoint = new Uri("http://localhost:4317"); // Replace with the appropriate endpoint
options.Protocol = OpenTelemetry.Exporter.OtlpExportProtocol.Grpc; // or HttpProtobuf
});
});
s.AddHostedService<MqttConsumerService>();
});

var host = builder.Build();

await host.RunAsync();
```

## Collected Metrics

What metrics does TurboMqtt expose?

* `recv_messages` - by `clientId`, `PacketType`, `MqttProtocolVersion`
* `recv_bytes` - by `clientId`, `MqttProtocolVersion`
* `sent_messages` - by `clientId`, `PacketType`, `MqttProtocolVersion`
* `sent_bytes` - by `clientId`, `MqttProtocolVersion`

## Disabling TurboMqtt OpenTelemetry for Performance Reasons

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`:

```csharp
var tcpClientOptions = new MqttClientTcpOptions(config.Host, config.Port);
var clientConnectOptions = new MqttClientConnectOptions(config.ClientId, MqttProtocolVersion.V3_1_1)
{
UserName = config.User,
Password = config.Password,
KeepAliveSeconds = 5,
EnableOpenTelemetry = false // disable telemetry
};

var client = await _clientFactory.CreateTcpClient(clientConnectOptions, tcpClientOptions);
```
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
UserName = config.User,
Password = config.Password,
KeepAliveSeconds = 5
KeepAliveSeconds = 5,
EnableOpenTelemetry = false // disable telemetry
};

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

0 comments on commit 41dafc1

Please sign in to comment.