Skip to content

Commit

Permalink
VmAgent endpoint to report GSDK version telemetry
Browse files Browse the repository at this point in the history
  • Loading branch information
tculotta committed Mar 20, 2024
1 parent 760c98d commit 7c3b7a4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
25 changes: 24 additions & 1 deletion LocalMultiplayerAgent/Controllers/SessionHostController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace LocalMultiplayerAgent.Controllers
using Microsoft.Azure.Gaming.LocalMultiplayerAgent;
using Microsoft.Azure.Gaming.VmAgent.Model;
using Microsoft.Extensions.Hosting;
using Newtonsoft.Json;
using Instrumentation;

public class SessionHostController : Controller
{
Expand Down Expand Up @@ -96,6 +96,29 @@ public async Task<IActionResult> ProcessHeartbeat(string sessionHostId,
});
}

private static bool _wasGsdkVersionLogged = false;
[HttpPost]
[Route("v1/metrics/{sessionHostId}/gsdkinfo")]
public IActionResult ReportGsdkVersion(string sessionHostId, [FromBody] GsdkVersionInfo vi)
{
if (string.IsNullOrEmpty(vi.Version))
{
return BadRequest($"{nameof(GsdkVersionInfo.Version)} should not be an empty string");
}
if (string.IsNullOrEmpty(vi.Flavor))
{
return BadRequest($"{nameof(GsdkVersionInfo.Flavor)} should not be an empty string");
}

if (!_wasGsdkVersionLogged)
{
Globals.MultiLogger.LogInformation($"GSDK flavor/version: {vi.Flavor}/{vi.Version} from session host {sessionHostId}");
_wasGsdkVersionLogged = true;
}

return Ok();
}

[HttpPatch]
[Route("v1/sessionHosts/{sessionHostId}")]
public Task<IActionResult> ProcessHeartbeatV1(
Expand Down
8 changes: 8 additions & 0 deletions LocalMultiplayerAgent/Instrumentation/GsdkVersionInfo.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
namespace LocalMultiplayerAgent.Instrumentation
{
public class GsdkVersionInfo
{
public string Flavor { get; set; } // Unreal/Unity/C#/C++ etc.
public string Version { get; set; }
}
}

0 comments on commit 7c3b7a4

Please sign in to comment.