Skip to content

Commit

Permalink
added solution id and account details
Browse files Browse the repository at this point in the history
  • Loading branch information
IamRanjeetSingh committed Sep 13, 2024
1 parent dbcacdf commit be7cdc5
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 12 deletions.
14 changes: 8 additions & 6 deletions Ginger/GingerCoreNET/Telemetry/Protos/V1/feature.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ package GingerTelemetryProto.v1;

message FeatureRecord {
string Id = 1;
string CreationTimestamp = 2;
string AppVersion = 3;
string UserId = 4;
string FeatureId = 5;
string Duration = 6;
string Metadata = 7;
string SolutionId = 2;
string Account = 3;
string CreationTimestamp = 4;
string AppVersion = 5;
string UserId = 6;
string FeatureId = 7;
string Duration = 8;
string Metadata = 9;
}

message AddFeaturesRequest {
Expand Down
14 changes: 8 additions & 6 deletions Ginger/GingerCoreNET/Telemetry/Protos/V1/log.proto
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ package GingerTelemetryProto.v1;

message LogRecord {
string Id = 1;
string CreationTimestamp = 2;
string AppVersion = 3;
string UserId = 4;
string Level = 5;
string Message = 6;
string Metadata = 7;
string SolutionId = 2;
string Account = 3;
string CreationTimestamp = 4;
string AppVersion = 5;
string UserId = 6;
string Level = 7;
string Message = 8;
string Metadata = 9;
}

message AddLogsRequest {
Expand Down
4 changes: 4 additions & 0 deletions Ginger/GingerCoreNET/Telemetry/TelemetryBaseRecord.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@ internal class TelemetryBaseRecord
{
public string Id { get; init; } = Guid.NewGuid().ToString();

public string SolutionId { get; init; }

public string Account { get; init; }

public required DateTime CreationTimestamp { get; init; }

public required DateTime LastUpdateTimestamp { get; set; }
Expand Down
4 changes: 4 additions & 0 deletions Ginger/GingerCoreNET/Telemetry/TelemetryCollector.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,8 @@ private AddLogsRequest CreateAddLogsRequest(IEnumerable<TelemetryLogRecord> logs
request.Logs.Add(new LogRecord()
{
Id = log.Id,
SolutionId = log.SolutionId,
Account = log.Account,
AppVersion = log.AppVersion,
UserId = log.UserId,
CreationTimestamp = log.CreationTimestamp.ToString("O"),
Expand Down Expand Up @@ -92,6 +94,8 @@ private AddFeaturesRequest CreateAddFeaturesRequest(IEnumerable<TelemetryFeature
request.Features.Add(new FeatureRecord()
{
Id = feature.Id,
SolutionId = feature.SolutionId,
Account = feature.Account,
AppVersion = feature.AppVersion,
UserId = feature.UserId,
CreationTimestamp = feature.CreationTimestamp.ToString("O"),
Expand Down
10 changes: 10 additions & 0 deletions Ginger/GingerCoreNET/Telemetry/TelemetryQueueManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using Amdocs.Ginger.Common;
using Amdocs.Ginger.Common.GeneralLib;
using Amdocs.Ginger.Common.Telemetry;
using Ginger.SolutionGeneral;
using Microsoft.Extensions.Logging;
using System;
using System.Collections.Generic;
Expand Down Expand Up @@ -91,8 +92,12 @@ public void AddLog(eLogLevel level, string msg, TelemetryMetadata metadata)
return;
}

Solution? solution = WorkSpace.Instance.Solution;

AddLog(new TelemetryLogRecord()
{
SolutionId = solution != null ? solution.Guid.ToString() : "",
Account = solution != null ? solution.Account : "",
AppVersion = ApplicationInfo.ApplicationBackendVersion,
UserId = WorkSpace.Instance.UserProfile.UserName,
CreationTimestamp = DateTime.UtcNow,
Expand All @@ -110,8 +115,13 @@ public void AddFeatureUsage(FeatureId featureId)

public void AddFeatureUsage(FeatureId featureId, TelemetryMetadata metadata)
{

Solution? solution = WorkSpace.Instance.Solution;

AddFeatureUsage(new TelemetryFeatureRecord()
{
SolutionId = solution != null ? solution.Guid.ToString() : "",
Account = solution != null ? solution.Account : "",
AppVersion = ApplicationInfo.ApplicationBackendVersion,
UserId = WorkSpace.Instance.UserProfile.UserName,
CreationTimestamp = DateTime.UtcNow,
Expand Down

0 comments on commit be7cdc5

Please sign in to comment.