Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

VmAgent endpoint to report GSDK version telemetry #179

Merged
merged 1 commit into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}");
tculotta marked this conversation as resolved.
Show resolved Hide resolved
_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; }
}
}
Loading