Skip to content

Commit da29411

Browse files
authored
feat: add telemetry enrichment to StartRequest (#63)
Adds `TelemetryEnricher` class and interface to enrich the `StartRequest` message with OS, device ID, and version information. Also adds the version to `Publish.ps1` so that it is available in released binaries.
1 parent e0a11dd commit da29411

File tree

8 files changed

+258
-160
lines changed

8 files changed

+258
-160
lines changed

.editorconfig

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,10 @@ resharper_web_config_module_not_resolved_highlighting = warning
7676
resharper_web_config_type_not_resolved_highlighting = warning
7777
resharper_web_config_wrong_module_highlighting = warning
7878

79-
[{*.json,*.jsonc,*.yml,*.yaml,*.proto}]
79+
[{*.json,*.jsonc,*.yml,*.yaml}]
8080
indent_style = space
8181
indent_size = 2
82+
83+
[{*.proto}]
84+
indent_style = tab
85+
indent_size = 1
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
using Coder.Desktop.Vpn.Proto;
2+
using Coder.Desktop.Vpn.Service;
3+
4+
namespace Coder.Desktop.Tests.Vpn.Service;
5+
6+
[TestFixture]
7+
public class TelemetryEnricherTest
8+
{
9+
[Test]
10+
public void EnrichStartRequest()
11+
{
12+
var req = new StartRequest
13+
{
14+
CoderUrl = "https://coder.example.com",
15+
};
16+
var enricher = new TelemetryEnricher();
17+
req = enricher.EnrichStartRequest(req);
18+
19+
// quick sanity check that non-telemetry fields aren't lost or overwritten
20+
Assert.That(req.CoderUrl, Is.EqualTo("https://coder.example.com"));
21+
22+
Assert.That(req.DeviceOs, Is.EqualTo("Windows"));
23+
// seems that test assemblies always set 1.0.0.0
24+
Assert.That(req.CoderDesktopVersion, Is.EqualTo("1.0.0.0"));
25+
Assert.That(req.DeviceId, Is.Not.Empty);
26+
var deviceId = req.DeviceId;
27+
28+
// deviceId is different on different machines, but we can test that
29+
// each instance of the TelemetryEnricher produces the same value.
30+
enricher = new TelemetryEnricher();
31+
req = enricher.EnrichStartRequest(new StartRequest());
32+
Assert.That(req.DeviceId, Is.EqualTo(deviceId));
33+
}
34+
}

Vpn.Proto/RpcVersion.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ namespace Coder.Desktop.Vpn.Proto;
55
/// </summary>
66
public class RpcVersion
77
{
8-
public static readonly RpcVersion Current = new(1, 0);
8+
public static readonly RpcVersion Current = new(1, 1);
99

1010
public ulong Major { get; }
1111
public ulong Minor { get; }

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy