Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Initial changes to add telemetry #2774

Merged
merged 26 commits into from
May 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
4941ebe
Initial changes
bhsubra May 20, 2021
bbbcc6e
Code cleanup
bhsubra May 20, 2021
d5815ac
Moved telemetry to declaration snippet insertion
bhsubra May 20, 2021
3c181e1
Updated readme
bhsubra May 20, 2021
0ef1a98
Added integration tests
bhsubra May 21, 2021
881e039
Code cleanup
bhsubra May 21, 2021
17a95d7
Fixed integration test
bhsubra May 21, 2021
a1bbe29
Fix issue in tests
bhsubra May 21, 2021
7a12275
Be explicit about VS Code telemetry
MarcusFelling May 24, 2021
468d9e1
Revert static removal
bhsubra May 24, 2021
59a3a6c
Reverted and cleaned up some changes with withCommand(..)
bhsubra May 24, 2021
b5e4f80
Cleaned up integration tests
bhsubra May 24, 2021
fd986a6
Addressed couple of CR comments
bhsubra May 24, 2021
b9caa74
Refactored TelemetryEvent creation
bhsubra May 24, 2021
186bb13
Addressed some cr feedback
bhsubra May 26, 2021
0f2b765
Added comment in BicepTelemetryHandler
bhsubra May 26, 2021
a2b850e
Posting telemetry events in couple other places
bhsubra May 26, 2021
dae29aa
Updated integration test
bhsubra May 26, 2021
6de1c07
Rebase from main
bhsubra May 27, 2021
33e32ce
Added integration tests for resource and module body snippet insertion
bhsubra May 27, 2021
f9547a0
PostEvent should throw if invalid arguments are passed
bhsubra May 27, 2021
6036330
Revert changes to auto generated file- CoreResources.Designer.cs
bhsubra May 27, 2021
e877e00
Another attempt at reverting auto generated file
bhsubra May 27, 2021
e62d299
Reverted changes in ln 1 CoreResources.Designer.cs
bhsubra May 27, 2021
731f299
Another attempt at reverting auto generated file
bhsubra May 27, 2021
62d6763
Fixed cr comments
bhsubra May 27, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Moved telemetry to declaration snippet insertion
  • Loading branch information
bhsubra committed May 27, 2021
commit d5815acf7fd9273157fb0d93a839e41fe116b427
20 changes: 10 additions & 10 deletions src/Bicep.LangServer/Completions/BicepCompletionProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,11 +85,19 @@ private IEnumerable<CompletionItem> GetDeclarationCompletions(BicepCompletionCon

foreach (Snippet resourceSnippet in SnippetsProvider.GetTopLevelNamedDeclarationSnippets())
{
Dictionary<string, string> properties = new Dictionary<string, string>()
{
{ "label", resourceSnippet.Prefix }
};
TelemetryEvent telemetryEvent = new("declaration-snippet-completion", properties);
Command command = Command.Create("bicep.telemetry", telemetryEvent);

yield return CreateContextualSnippetCompletion(resourceSnippet.Prefix,
resourceSnippet.Detail,
resourceSnippet.Text,
context.ReplacementRange,
resourceSnippet.CompletionPriority);
resourceSnippet.CompletionPriority,
command: command);
}
}

Expand Down Expand Up @@ -399,20 +407,12 @@ private IEnumerable<CompletionItem> CreateResourceBodyCompletions(SemanticModel

foreach (Snippet snippet in snippets)
{
Dictionary<string, string> properties = new Dictionary<string, string>()
{
{ "label", snippet!.Prefix }
};
TelemetryEvent telemetryEvent = new("snippet-insertion", properties);
Command command = Command.Create("bicep.telemetry", telemetryEvent);

yield return CreateContextualSnippetCompletion(snippet!.Prefix,
snippet.Detail,
snippet.Text,
context.ReplacementRange,
snippet.CompletionPriority,
preselect: true,
command: command);
preselect: true);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/Bicep.LangServer/Telemetry/TelemetryProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class TelemetryProvider : ITelemetryProvider

public void PostEvent(TelemetryEvent telemetryEvent)
{
if (telemetryEvent == null || telemetryEvent.Properties?.Count == 0)
if (telemetryEvent is null || telemetryEvent.Properties?.Count == 0)
{
return;
}
Expand Down