{"action":"created","issue":{"url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/issues/783","repository_url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet","labels_url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/issues/783/labels{/name}","comments_url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/issues/783/comments","events_url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/issues/783/events","html_url":"https://github.com/Microsoft/ApplicationInsights-dotnet/issues/783","id":316019535,"number":783,"title":"Sending metrics to any Azure resrouce from the SDK","user":{"login":"macrogreg","id":20691812,"avatar_url":"https://avatars3.githubusercontent.com/u/20691812?v=4","gravatar_id":"","url":"https://api.github.com/users/macrogreg","html_url":"https://github.com/macrogreg","followers_url":"https://api.github.com/users/macrogreg/followers","following_url":"https://api.github.com/users/macrogreg/following{/other_user}","gists_url":"https://api.github.com/users/macrogreg/gists{/gist_id}","starred_url":"https://api.github.com/users/macrogreg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macrogreg/subscriptions","organizations_url":"https://api.github.com/users/macrogreg/orgs","repos_url":"https://api.github.com/users/macrogreg/repos","events_url":"https://api.github.com/users/macrogreg/events{/privacy}","received_events_url":"https://api.github.com/users/macrogreg/received_events","type":"User","site_admin":false},"labels":[{"id":364689735,"url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/labels/discussion","name":"discussion","color":"d4c5f9","default":false},{"id":907718059,"url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/labels/metrics","name":"metrics","color":"a4c2f4","default":false}],"state":"open","locked":false,"assignee":{"login":"SergeyKanzhelev","id":9950081,"avatar_url":"https://avatars2.githubusercontent.com/u/9950081?v=4","gravatar_id":"","url":"https://api.github.com/users/SergeyKanzhelev","html_url":"https://github.com/SergeyKanzhelev","followers_url":"https://api.github.com/users/SergeyKanzhelev/followers","following_url":"https://api.github.com/users/SergeyKanzhelev/following{/other_user}","gists_url":"https://api.github.com/users/SergeyKanzhelev/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyKanzhelev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyKanzhelev/subscriptions","organizations_url":"https://api.github.com/users/SergeyKanzhelev/orgs","repos_url":"https://api.github.com/users/SergeyKanzhelev/repos","events_url":"https://api.github.com/users/SergeyKanzhelev/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyKanzhelev/received_events","type":"User","site_admin":false},"assignees":[{"login":"SergeyKanzhelev","id":9950081,"avatar_url":"https://avatars2.githubusercontent.com/u/9950081?v=4","gravatar_id":"","url":"https://api.github.com/users/SergeyKanzhelev","html_url":"https://github.com/SergeyKanzhelev","followers_url":"https://api.github.com/users/SergeyKanzhelev/followers","following_url":"https://api.github.com/users/SergeyKanzhelev/following{/other_user}","gists_url":"https://api.github.com/users/SergeyKanzhelev/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyKanzhelev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyKanzhelev/subscriptions","organizations_url":"https://api.github.com/users/SergeyKanzhelev/orgs","repos_url":"https://api.github.com/users/SergeyKanzhelev/repos","events_url":"https://api.github.com/users/SergeyKanzhelev/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyKanzhelev/received_events","type":"User","site_admin":false},{"login":"Dmitry-Matveev","id":12158043,"avatar_url":"https://avatars0.githubusercontent.com/u/12158043?v=4","gravatar_id":"","url":"https://api.github.com/users/Dmitry-Matveev","html_url":"https://github.com/Dmitry-Matveev","followers_url":"https://api.github.com/users/Dmitry-Matveev/followers","following_url":"https://api.github.com/users/Dmitry-Matveev/following{/other_user}","gists_url":"https://api.github.com/users/Dmitry-Matveev/gists{/gist_id}","starred_url":"https://api.github.com/users/Dmitry-Matveev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Dmitry-Matveev/subscriptions","organizations_url":"https://api.github.com/users/Dmitry-Matveev/orgs","repos_url":"https://api.github.com/users/Dmitry-Matveev/repos","events_url":"https://api.github.com/users/Dmitry-Matveev/events{/privacy}","received_events_url":"https://api.github.com/users/Dmitry-Matveev/received_events","type":"User","site_admin":false},{"login":"macrogreg","id":20691812,"avatar_url":"https://avatars3.githubusercontent.com/u/20691812?v=4","gravatar_id":"","url":"https://api.github.com/users/macrogreg","html_url":"https://github.com/macrogreg","followers_url":"https://api.github.com/users/macrogreg/followers","following_url":"https://api.github.com/users/macrogreg/following{/other_user}","gists_url":"https://api.github.com/users/macrogreg/gists{/gist_id}","starred_url":"https://api.github.com/users/macrogreg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/macrogreg/subscriptions","organizations_url":"https://api.github.com/users/macrogreg/orgs","repos_url":"https://api.github.com/users/macrogreg/repos","events_url":"https://api.github.com/users/macrogreg/events{/privacy}","received_events_url":"https://api.github.com/users/macrogreg/received_events","type":"User","site_admin":false}],"milestone":{"url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/milestones/28","html_url":"https://github.com/Microsoft/ApplicationInsights-dotnet/milestone/28","labels_url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/milestones/28/labels","id":3272220,"number":28,"title":"2.7","description":"","creator":{"login":"MS-TimothyMothra","id":28785781,"avatar_url":"https://avatars0.githubusercontent.com/u/28785781?v=4","gravatar_id":"","url":"https://api.github.com/users/MS-TimothyMothra","html_url":"https://github.com/MS-TimothyMothra","followers_url":"https://api.github.com/users/MS-TimothyMothra/followers","following_url":"https://api.github.com/users/MS-TimothyMothra/following{/other_user}","gists_url":"https://api.github.com/users/MS-TimothyMothra/gists{/gist_id}","starred_url":"https://api.github.com/users/MS-TimothyMothra/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/MS-TimothyMothra/subscriptions","organizations_url":"https://api.github.com/users/MS-TimothyMothra/orgs","repos_url":"https://api.github.com/users/MS-TimothyMothra/repos","events_url":"https://api.github.com/users/MS-TimothyMothra/events{/privacy}","received_events_url":"https://api.github.com/users/MS-TimothyMothra/received_events","type":"User","site_admin":false},"open_issues":13,"closed_issues":2,"state":"open","created_at":"2018-04-16T23:02:32Z","updated_at":"2018-04-20T22:27:01Z","due_on":"2018-07-01T07:00:00Z","closed_at":null},"comments":14,"created_at":"2018-04-19T19:59:11Z","updated_at":"2018-05-02T19:28:40Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"Hi folks,\r\n \r\nAzure is standardizing an ingestion API for metrics. \r\n\r\nThere are a few key differences between that API and the current Application Insights API that matter here:\r\n\r\n- The new API can accept metrics about any Azure resource, not only Application Insights components.\r\n- The new API identifies resources by their ARM resource ID, not their IKey.\r\n- The new API requires authentication (via AAD tokens).\r\n- The new API is regional. Metrics must be explicitly sent to the endpoint located in the same region as the target resource.\r\n \r\nWe need to support sending metrics about any Azure resource to the new ingestion endpoint from the SDK.\r\n\r\nWe had some discussions about the high level approach with @SergeyKanzhelev  and  @karolz-ms . The goal here is to discuss this with a wider community and to document our plans. Also, note that this is high-level for now. As the discussion evolves, we will add more precise details in comments to this issue.\r\n \r\n*Key assumption*:\r\nThe vision is to evolve the AI SDK to the “One Azure Telemetry SDK”. In the process of this we will likely add a central, general way to send any kind of telemetry to any kind of Azure resources. We are not solving this general problem for now. The goal at hand is to merely send metric telemetry to the right place with an explicit understanding that addressing and authentication approach we use may evolve over time.\r\n\r\n*Solution approach*:\r\n \r\n- We will use the “sink” functionality available in the SDK pipeline. We will create a sink for sending metrics to the new endpoint. The sink will be configured in the normal manner (like any other App Insights config today).\r\n \r\n- Authentication information will be part of the sink configuration (e.g. certificate thumbprints necessary to obtain AAD tokens).\r\n \r\n- In v1, the endpoint address will be an explicit part of the sink configuration. I.e. the user must configure the endpoint for the right region. In subsequent versions we will use ARM discovery APIs to automatically determine the correct region. \r\n \r\n- To address metrics we will use the existing iKey field: \r\n\r\n  - If the string contained in the iKey field of a metric telemetry item has a specific well-defined prefix, the SDK will assume that the sub-string after that prefix is an ARM resource ID and not an instrumentation key. It will then use the aforementioned sink to send the telemetry item.\r\n\r\n  - Otherwise the item will be send through the “normal” Application Insights channel.\r\n \r\n- Setting the iKey field for metric telemetry items can happen using any of the existing approaches. For example: \r\n\r\n  - Set the `InstrumentationKey` field on the `TelemetryClient`, and use `MetricAggregationScope.TelemetryClient` value in `GetMetric(..)` methods;\r\n\r\n  - Use a metric dimension with the name defined in the `MetricDimensionNames.TelemetryContext.InstrumentationKey` constant and the value of the ARM resource ID with the aforementioned prefix (or the iKey).\r\n\r\n  - Use `InstrumentationKey` on the application `TelemetryConfiguration` instance.\r\n\r\n  - Issue: The first 2 approaches are verbose: they require a setting for every metric. This is fine when many different resources must be addressed, but cumbersome when all metrics target the same resources.\r\nOn the other hand, setting `InstrumentationKey` on `TelemetryConfiguration` will prevent non-metric telemetry from working. We need to address this in v2. One possibility is to address this is to add a property like `InstrumentationKey` to the `MetricManager`.\r\n"},"comment":{"url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/issues/comments/386093038","html_url":"https://github.com/Microsoft/ApplicationInsights-dotnet/issues/783#issuecomment-386093038","issue_url":"https://api.github.com/repos/Microsoft/ApplicationInsights-dotnet/issues/783","id":386093038,"user":{"login":"SergeyKanzhelev","id":9950081,"avatar_url":"https://avatars2.githubusercontent.com/u/9950081?v=4","gravatar_id":"","url":"https://api.github.com/users/SergeyKanzhelev","html_url":"https://github.com/SergeyKanzhelev","followers_url":"https://api.github.com/users/SergeyKanzhelev/followers","following_url":"https://api.github.com/users/SergeyKanzhelev/following{/other_user}","gists_url":"https://api.github.com/users/SergeyKanzhelev/gists{/gist_id}","starred_url":"https://api.github.com/users/SergeyKanzhelev/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/SergeyKanzhelev/subscriptions","organizations_url":"https://api.github.com/users/SergeyKanzhelev/orgs","repos_url":"https://api.github.com/users/SergeyKanzhelev/repos","events_url":"https://api.github.com/users/SergeyKanzhelev/events{/privacy}","received_events_url":"https://api.github.com/users/SergeyKanzhelev/received_events","type":"User","site_admin":false},"created_at":"2018-05-02T19:28:40Z","updated_at":"2018-05-02T19:28:40Z","author_association":"MEMBER","body":"I support @Dmitry-Matveev on this. Specially-constructed `TelemetryClient` is more aligned with other long-term requirements. So `TelemetryClient.ForResource` it is"}}
{"actor":{"display_login":"SergeyKanzhelev"}}