Skip to content

Commit

Permalink
Remove TelemetryManager from the sdk
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitpubnub committed Jul 8, 2024
1 parent fcb7848 commit 9ac839b
Show file tree
Hide file tree
Showing 76 changed files with 403 additions and 946 deletions.
47 changes: 24 additions & 23 deletions .pubnub.yml
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,7 @@ supported-platforms:
- .Net Framework 4.0
- .Net Framework 4.5
- .Net Framework 4.6.1+
- .Net Framework 6.0
-
version: PubnubPCL 'C#' 6.20.1
platforms:
Expand Down Expand Up @@ -892,9 +893,9 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1031,9 +1032,9 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1152,10 +1153,10 @@ sdks:
supported-operating-systems:
Android:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
target-api-level:
- 11
minimum-api-level:
Expand All @@ -1172,10 +1173,10 @@ sdks:
- ARMv7 (Cortex) CPU with NEON support
iOS:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- iOS 9.0
maximum-os-version:
Expand All @@ -1189,10 +1190,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1269,7 +1270,7 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
maximum-os-version:
Expand All @@ -1280,10 +1281,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Mac OS X 10.8
maximum-os-version:
Expand Down Expand Up @@ -1330,7 +1331,7 @@ sdks:
supported-operating-systems:
Android:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
target-api-level:
Expand All @@ -1349,10 +1350,10 @@ sdks:
- ARMv7 (Cortex) CPU with NEON support
iOS:
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- iOS 9.0
maximum-os-version:
Expand All @@ -1366,10 +1367,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Windows 10 Home
- Windows 10 Pro
Expand Down Expand Up @@ -1446,10 +1447,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
maximum-os-version:
- Ubuntu 20.04 LTS
minimum-os-version:
Expand All @@ -1458,10 +1459,10 @@ sdks:
target-architecture:
- x86-64
runtime-version:
- .NET 4.x Equivalent
- .NET 6.x Equivalent
api-compatibility:
- .NET Core 2
- .NET 4.x
- .NET 6.x
minimum-os-version:
- Mac OS X 10.8
maximum-os-version:
Expand Down Expand Up @@ -1643,4 +1644,4 @@ sdks:
- Windows Server 2012 R2 Foundation
- Windows Server 2012 R2 Essentials
- Windows Server 2012 R2 Standard
- Windows Server 2012 R2 Datacenter
- Windows Server 2012 R2 Datacenter
16 changes: 1 addition & 15 deletions src/Api/PubnubApi/Builder/UrlRequestBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,14 @@ public sealed class UrlRequestBuilder : IUrlRequestBuilder
private readonly IPubnubUnitTest pubnubUnitTest;
private readonly IPubnubLog pubnubLog;
private readonly string pubnubInstanceId;
private readonly EndPoint.TelemetryManager telemetryMgr;
private readonly EndPoint.TokenManager tokenMgr;

public UrlRequestBuilder(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnitTest, IPubnubLog log, EndPoint.TelemetryManager pubnubTelemetryMgr, EndPoint.TokenManager pubnubTokenMgr, string pnInstanceId)
public UrlRequestBuilder(PNConfiguration config, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnitTest, IPubnubLog log, EndPoint.TokenManager pubnubTokenMgr, string pnInstanceId)
{
pubnubConfig.AddOrUpdate(pnInstanceId, config, (k, o) => config);
this.jsonLib = jsonPluggableLibrary;
this.pubnubUnitTest = pubnubUnitTest;
this.pubnubLog = log;
this.telemetryMgr = pubnubTelemetryMgr;
this.tokenMgr = pubnubTokenMgr;
this.pubnubInstanceId = string.IsNullOrEmpty(pnInstanceId) ? "" : pnInstanceId;
}
Expand Down Expand Up @@ -2076,18 +2074,6 @@ private Dictionary<string, string> GenerateCommonQueryParams(PNOperationType typ
ret.Add("instanceid", pubnubInstanceId);
}

if (pubnubConfig.ContainsKey(pubnubInstanceId) && pubnubConfig[pubnubInstanceId].EnableTelemetry && telemetryMgr != null)
{
Dictionary<string, string> opsLatency = telemetryMgr.GetOperationsLatency().ConfigureAwait(false).GetAwaiter().GetResult();
if (opsLatency != null && opsLatency.Count > 0)
{
foreach (string key in opsLatency.Keys)
{
ret.Add(key, opsLatency[key]);
}
}
}

if (pubnubConfig.ContainsKey(pubnubInstanceId) && !string.IsNullOrEmpty(pubnubConfig[pubnubInstanceId].SecretKey))
{
ret.Add("timestamp", timeStamp.ToString(CultureInfo.InvariantCulture));
Expand Down
2 changes: 1 addition & 1 deletion src/Api/PubnubApi/ClientNetworkStatus.cs
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ private static async Task<bool> CheckSocketConnect<T>(object internetState)
pubnubCallback = state.PubnubCallbacck;
}

IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(pubnubConfig, jsonLib, unit, pubnubLog, null, null, "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(pubnubConfig, jsonLib, unit, pubnubLog, null, "");
Uri requestUri = urlBuilder.BuildTimeRequest("GET", "", null);
try
{
Expand Down
8 changes: 3 additions & 5 deletions src/Api/PubnubApi/EndPoint/Access/AuditOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,21 +17,19 @@ public class AuditOperation : PubnubCoreBase
private readonly IJsonPluggableLibrary jsonLibrary;
private readonly IPubnubUnitTest unit;
private readonly IPubnubLog pubnubLog;
private readonly EndPoint.TelemetryManager pubnubTelemetryMgr;

private string channelName;
private string channelGroupName;
private string[] authenticationKeys;
private PNCallback<PNAccessManagerAuditResult> savedCallback;
private Dictionary<string, object> queryParam;

public AuditOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log, EndPoint.TelemetryManager telemetryManager, Pubnub instance) : base(pubnubConfig, jsonPluggableLibrary, pubnubUnit, log, telemetryManager, null, instance)
public AuditOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log, Pubnub instance) : base(pubnubConfig, jsonPluggableLibrary, pubnubUnit, log, null, instance)
{
config = pubnubConfig;
jsonLibrary = jsonPluggableLibrary;
unit = pubnubUnit;
pubnubLog = log;
pubnubTelemetryMgr = telemetryManager;
}

public AuditOperation Channel(string channel)
Expand Down Expand Up @@ -113,7 +111,7 @@ internal void AuditAccess(string channel, string channelGroup, string[] authKeys

string authKeysCommaDelimited = (authKeys != null && authKeys.Length > 0) ? string.Join(",", authKeys.OrderBy(x => x).ToArray()) : "";

IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Uri request = urlBuilder.BuildAuditAccessRequest("GET", "", channel, channelGroup, authKeysCommaDelimited, externalQueryParam);

RequestState<PNAccessManagerAuditResult> requestState = new RequestState<PNAccessManagerAuditResult>();
Expand Down Expand Up @@ -154,7 +152,7 @@ internal async Task<PNResult<PNAccessManagerAuditResult>> AuditAccess(string cha

string authKeysCommaDelimited = (authKeys != null && authKeys.Length > 0) ? string.Join(",", authKeys.OrderBy(x => x).ToArray()) : "";

IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Uri request = urlBuilder.BuildAuditAccessRequest("GET", "", channel, channelGroup, authKeysCommaDelimited, externalQueryParam);

RequestState<PNAccessManagerAuditResult> requestState = new RequestState<PNAccessManagerAuditResult>();
Expand Down
9 changes: 3 additions & 6 deletions src/Api/PubnubApi/EndPoint/Access/GrantOperation.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Threading;
using System.Net;
Expand All @@ -18,7 +17,6 @@ public class GrantOperation : PubnubCoreBase
private readonly IJsonPluggableLibrary jsonLibrary;
private readonly IPubnubUnitTest unit;
private readonly IPubnubLog pubnubLog;
private readonly EndPoint.TelemetryManager pubnubTelemetryMgr;

private string[] pubnubChannelNames;
private string[] pubnubChannelGroupNames;
Expand All @@ -35,13 +33,12 @@ public class GrantOperation : PubnubCoreBase
private PNCallback<PNAccessManagerGrantResult> savedCallback;
private Dictionary<string, object> queryParam;

public GrantOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log, EndPoint.TelemetryManager telemetryManager, Pubnub instance) : base(pubnubConfig, jsonPluggableLibrary, pubnubUnit, log, telemetryManager, null, instance)
public GrantOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log, Pubnub instance) : base(pubnubConfig, jsonPluggableLibrary, pubnubUnit, log, null, instance)
{
config = pubnubConfig;
jsonLibrary = jsonPluggableLibrary;
unit = pubnubUnit;
pubnubLog = log;
pubnubTelemetryMgr = telemetryManager;
}

public GrantOperation Channels(string[] channels)
Expand Down Expand Up @@ -224,7 +221,7 @@ internal void GrantAccess(PNCallback<PNAccessManagerGrantResult> callback)
string targetUuidsCommaDelimited = string.Join(",", uuidList.OrderBy(x => x).ToArray());
string authKeysCommaDelimited = string.Join(",", authList.OrderBy(x => x).ToArray());

IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Uri request = urlBuilder.BuildGrantV2AccessRequest("GET", "", channelsCommaDelimited, channelGroupsCommaDelimited, targetUuidsCommaDelimited, authKeysCommaDelimited, this.grantRead, this.grantWrite, this.grantDelete, this.grantManage, this.grantGet, this.grantUpdate, this.grantJoin, this.grantTTL, this.queryParam);

RequestState<PNAccessManagerGrantResult> requestState = new RequestState<PNAccessManagerGrantResult>();
Expand Down Expand Up @@ -290,7 +287,7 @@ internal async Task<PNResult<PNAccessManagerGrantResult>> GrantAccess()
string targetUuidsCommaDelimited = string.Join(",", uuidList.OrderBy(x => x).ToArray());
string authKeysCommaDelimited = string.Join(",", authList.OrderBy(x => x).ToArray());

IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Uri request = urlBuilder.BuildGrantV2AccessRequest("GET", "", channelsCommaDelimited, channelGroupsCommaDelimited, targetUuidsCommaDelimited,authKeysCommaDelimited, this.grantRead, this.grantWrite, this.grantDelete, this.grantManage, this.grantGet, this.grantUpdate, this.grantJoin, this.grantTTL, this.queryParam);

RequestState<PNAccessManagerGrantResult> requestState = new RequestState<PNAccessManagerGrantResult>();
Expand Down
8 changes: 3 additions & 5 deletions src/Api/PubnubApi/EndPoint/Access/GrantTokenOperation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class GrantTokenOperation : PubnubCoreBase
private readonly IJsonPluggableLibrary jsonLibrary;
private readonly IPubnubUnitTest unit;
private readonly IPubnubLog pubnubLog;
private readonly EndPoint.TelemetryManager pubnubTelemetryMgr;

private PNTokenResources pubnubResources = new PNTokenResources
{
Expand All @@ -44,13 +43,12 @@ public class GrantTokenOperation : PubnubCoreBase
private string pubnubAuthorizedUuid = string.Empty;
private string pubnubAuthorizedUserId = string.Empty;

public GrantTokenOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log, EndPoint.TelemetryManager telemetryManager, EndPoint.TokenManager tokenManager, Pubnub instance) : base(pubnubConfig, jsonPluggableLibrary, pubnubUnit, log, telemetryManager, tokenManager, instance)
public GrantTokenOperation(PNConfiguration pubnubConfig, IJsonPluggableLibrary jsonPluggableLibrary, IPubnubUnitTest pubnubUnit, IPubnubLog log, EndPoint.TokenManager tokenManager, Pubnub instance) : base(pubnubConfig, jsonPluggableLibrary, pubnubUnit, log, tokenManager, instance)
{
config = pubnubConfig;
jsonLibrary = jsonPluggableLibrary;
unit = pubnubUnit;
pubnubLog = log;
pubnubTelemetryMgr = telemetryManager;
PubnubInstance = instance;

InitializeDefaultVariableObjectStates();
Expand Down Expand Up @@ -326,7 +324,7 @@ internal void GrantAccess(PNCallback<PNAccessManagerTokenResult> callback)
string requestMethodName = "POST";
string postMessage = jsonLibrary.SerializeToJsonString(messageEnvelope);
byte[] postData = Encoding.UTF8.GetBytes(postMessage);
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Uri request = urlBuilder.BuildGrantV3AccessRequest(requestMethodName, postMessage, this.queryParam);

UrlProcessRequest(request, requestState, false, postData).ContinueWith(r =>
Expand Down Expand Up @@ -458,7 +456,7 @@ internal async Task<PNResult<PNAccessManagerTokenResult>> GrantAccess()
string requestMethodName = "POST";
string postMessage = jsonLibrary.SerializeToJsonString(messageEnvelope);
byte[] postData = Encoding.UTF8.GetBytes(postMessage);
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, pubnubTelemetryMgr, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
IUrlRequestBuilder urlBuilder = new UrlRequestBuilder(config, jsonLibrary, unit, pubnubLog, null, (PubnubInstance != null) ? PubnubInstance.InstanceId : "");
Uri request = urlBuilder.BuildGrantV3AccessRequest(requestMethodName, postMessage, this.queryParam);

RequestState<PNAccessManagerTokenResult> requestState = new RequestState<PNAccessManagerTokenResult>();
Expand Down
Loading

0 comments on commit 9ac839b

Please sign in to comment.