-
Notifications
You must be signed in to change notification settings - Fork 4.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Deserialize custom dimensions from application insights API response (#…
…14917) * Deserialize custom dimensions from application insights API response. Fixes #13042 * Test non-empty CustomDimensions from application insights API response Co-authored-by: Oleg Deribas <olegd@superoffice.com>
- Loading branch information
1 parent
3540eb4
commit 58a48f0
Showing
2 changed files
with
30 additions
and
0 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
...Azure.ApplicationInsights.Query/src/Customized/Models/EventsResultDataCustomDimensions.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
using System.Collections.Generic; | ||
using Newtonsoft.Json; | ||
using Newtonsoft.Json.Linq; | ||
|
||
namespace Microsoft.Azure.ApplicationInsights.Query.Models | ||
{ | ||
public partial class EventsResultDataCustomDimensions | ||
{ | ||
#pragma warning disable CS0649 // Field is never assigned to, and will always have its default value | ||
[JsonExtensionData] | ||
private IDictionary<string, JToken> _customDimensionsValues; | ||
#pragma warning restore CS0649 // Field is never assigned to, and will always have its default value | ||
|
||
public IEnumerable<string> Keys => _customDimensionsValues?.Keys; | ||
|
||
public bool TryGetValue(string key, out string value) | ||
{ | ||
if (_customDimensionsValues != null && _customDimensionsValues.TryGetValue(key, out var jToken)) | ||
{ | ||
value = jToken?.ToString(); | ||
return true; | ||
} | ||
value = null; | ||
return false; | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters