cpp_client_telemetry
cpp_client_telemetry copied to clipboard
Add support for multiple collector endpoints in one TelemetryManager instance
Current library state and problem statement:
Multi user scenario implies that a number of users (greater that 1) can make and receive a Call during 1C3 communication stack life time without library being restarted.
One of the user-dependent context information in case of user being part of restricted/geo-locked cloud may be Telemetry ingestion URL, which must be different from regular production URL due to privacy/security requirements for specific cloud.
Problem statement: Current 1DS library design allows for 2 ways of configuring ingestion URL; -At library start , either using defaults or override provided via Setup key. -At runtime, using ECS configuration.
Main issue with both methods is that the URL is set globally for all events, the ones cached from previous sessions and currently received ones. Given that events may not be sent immediately but rather could be stored into data base for later processing and sending, there is no guarantee that event stored at any time will be sent with the URL that matches the user context.
In short, current telemetry event do not carry enough user context, they need to respect the user context they were created with.
Additionally, it should be possible to configure ingestion URL-s according to user context without restarting IC3 communications library.
Proposed changes:
Per-user ingestion URL-s
Library needs to have a notion of storing multiple ingestion URLs together with an account/user context. <std::pair<std::string: Account, std:string URL>>
Event stamping with user context
Event post interface needs to be updated with contextID field, which will represent the account/user context in which event needs to be sent. Library will add correct ingestion URL to event payload by matching account ID with appropriate URL obtained from configuration. At event sending time, URL will be read from event properties instead of configuration. This will require SQLite schema change in order to add new field to event storage table.
@VadimRomanets - As we can achieve multiple instances in one process using separate LogManager per user, can you please add more context here why that setup doesn't work for you.
@lalitb issue here is once event is received by 1DS library it is stored into db and loses all user-context , meaning you don't know anymore to which collector url event needs to be sent to.
Note that Collector url in code below is global per LogManager, this has several implications:
- if this logmanager was used in previous session with url 1 and was configured in new one with url 2, all stored events will be sent to url 2, creating a data leak.
- if collector url is reconfigured on runtime to url 2 , all events that were put to storage prior will be sent to new url, creating a data leak.
- If one Logmanager instance per cloud would be used, client needs to also track that storage is initialized with separate paths per instance, adding complexity to UI code which can introduce additional failure scenarios, not mentioning code duplication across all integration points. Currently such requirements for Logmanager instance managements are not clear in multi-user scenarios.
` bool HttpRequestEncoder::handleEncode(EventsUploadContextPtr const& ctx) { ctx->httpRequest = m_httpClient.CreateRequest(); ctx->httpRequestId = ctx->httpRequest->GetId();
ctx->httpRequest->SetMethod("POST");
ctx->httpRequest->SetUrl(m_config.GetCollectorUrl());
ctx->httpRequest->GetHeaders().set("Expect", "100-continue");
ctx->httpRequest->GetHeaders().set("SDK-Version", PAL::getSdkVersion());
ctx->httpRequest->GetHeaders().set("Client-Id", "NO_AUTH");
ctx->httpRequest->GetHeaders().set("Content-Type", "application/bond-compact-binary");
ctx->httpRequest->GetHeaders().set("Upload-Time", toString(PAL::getUtcSystemTimeMs()));`
@VadimRomanets - In order to get this prioritized for next planning, can you ask the PM from your team to add a dependency ask for Observability. It can be done with @cartersocha.
Thanks Lalit, I'll loop in relevant people.
@Olga @.>, please create a dependency ask as mentioned in email. @Petrus @.> FYI
Cheers, Vadim Romanets From: Lalit Kumar Bhasin @.> Sent: Tuesday, November 30, 2021 10:32 PM To: microsoft/cpp_client_telemetry @.> Cc: Vadim Romanets @.>; Mention @.> Subject: Re: [microsoft/cpp_client_telemetry] Add support for multiple collector endpoints in one TelemetryManager instance (Issue #947)
@VadimRomanetshttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2FVadimRomanets&data=04%7C01%7Cvadim.romanets%40skype.net%7C0342993df2064759c59e08d9b4407aa7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637739011349975427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=Q9Vh7L8CibAH%2FINZUSJ7Ri0IVfAs2hdKk%2Bz5RLJmKDw%3D&reserved=0 - In order to get this prioritized for next planning, can you ask the PM from your team to add a dependency ask for Observability. It can be done with @cartersochahttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fcartersocha&data=04%7C01%7Cvadim.romanets%40skype.net%7C0342993df2064759c59e08d9b4407aa7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637739011349975427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=YqLLxw%2BG3QUkI0q9i%2FF3dDMbdwY7rnpwNnCk7BD1w3c%3D&reserved=0.
You are receiving this because you were mentioned. Reply to this email directly, view it on GitHubhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fmicrosoft%2Fcpp_client_telemetry%2Fissues%2F947%23issuecomment-982996431&data=04%7C01%7Cvadim.romanets%40skype.net%7C0342993df2064759c59e08d9b4407aa7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637739011349975427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=GcWut%2FHKe8BVSHH7ShvPPc20fkD9pgJRVbiAm7zaEzw%3D&reserved=0, or unsubscribehttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAWKCOGHPFWSYWQXHFYS6RKTUOUYEPANCNFSM5HGP52PQ&data=04%7C01%7Cvadim.romanets%40skype.net%7C0342993df2064759c59e08d9b4407aa7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637739011349975427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=UA9%2FBd3LkpicEe%2BynjkVAFv0tMb%2Bt6b57P3QhSfvZvo%3D&reserved=0. Triage notifications on the go with GitHub Mobile for iOShttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fapps.apple.com%2Fapp%2Fapple-store%2Fid1477376905%3Fct%3Dnotification-email%26mt%3D8%26pt%3D524675&data=04%7C01%7Cvadim.romanets%40skype.net%7C0342993df2064759c59e08d9b4407aa7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637739011349975427%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=yqvfkY7nOtPgnSnN3xYa7cXQdwVdfi%2BQs%2FMTJZjkjq8%3D&reserved=0 or Androidhttps://nam06.safelinks.protection.outlook.com/?url=https%3A%2F%2Fplay.google.com%2Fstore%2Fapps%2Fdetails%3Fid%3Dcom.github.android%26referrer%3Dutm_campaign%253Dnotification-email%2526utm_medium%253Demail%2526utm_source%253Dgithub&data=04%7C01%7Cvadim.romanets%40skype.net%7C0342993df2064759c59e08d9b4407aa7%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C637739011350025414%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000&sdata=%2BaH67pqTq2tspsMYOiTDPXM%2BBnTE5Wy64crMafuKHnI%3D&reserved=0.
@VadimRomanets - There has been fix to support separate collector endpoints through multiple logManagers for iOS ( #1021 ). Can you validate if this issue is fixed with the latest release?