Skip to content

Commit f802848

Browse files
committed
feat: add telemetry enrichment to StartRequest
1 parent e0a11dd commit f802848

File tree

7 files changed

+253
-159
lines changed

7 files changed

+253
-159
lines changed
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