Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,8 @@
<UseWPF>true</UseWPF>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)' == 'Debug'">
<DeployExtension>True</DeployExtension>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="CodingWithCalvin.Otel4Vsix" Version="0.2.2" />
<PackageReference Include="CouchbaseNetClient" Version="3.8.1" />
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.14.40265" />
</ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
using System;
using System;
using System.Runtime.InteropServices;
using System.Threading;
using CodingWithCalvin.CouchbaseExplorer.Editors;
using CodingWithCalvin.Otel4Vsix;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;

Expand Down Expand Up @@ -32,6 +33,20 @@ IProgress<ServiceProgressData> progress
{
await JoinableTaskFactory.SwitchToMainThreadAsync();

var builder = VsixTelemetry.Configure()
.WithServiceName(VsixInfo.DisplayName)
.WithServiceVersion(VsixInfo.Version)
.WithVisualStudioAttributes(this)
.WithEnvironmentAttributes();

#if !DEBUG
builder
.WithOtlpHttp("https://api.honeycomb.io")
.WithHeader("x-honeycomb-team", HoneycombConfig.ApiKey);
#endif

builder.Initialize();

// Register the editor factory
_editorFactory = new DocumentEditorFactory();
RegisterEditorFactory(_editorFactory);
Expand All @@ -43,6 +58,7 @@ protected override void Dispose(bool disposing)
{
if (disposing)
{
VsixTelemetry.Shutdown();
_editorFactory?.Dispose();
}
base.Dispose(disposing);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
using System;
using System;
using System.Collections.Generic;
using System.ComponentModel.Design;
using CodingWithCalvin.Otel4Vsix;
using Microsoft.VisualStudio.Shell;
using Microsoft.VisualStudio.Shell.Interop;

Expand Down Expand Up @@ -44,14 +46,30 @@ public static void Initialize(Package package)

private void ShowToolWindow(object sender, EventArgs e)
{
var window = this._package.FindToolWindow(typeof(CouchbaseExplorerWindow), 0, true);
if (window?.Frame == null)
using var activity = VsixTelemetry.StartCommandActivity("CouchbaseExplorer.ShowToolWindow");

try
{
throw new NotSupportedException("Cannot create tool window");
}
var window = this._package.FindToolWindow(typeof(CouchbaseExplorerWindow), 0, true);
if (window?.Frame == null)
{
throw new NotSupportedException("Cannot create tool window");
}

var windowFrame = (IVsWindowFrame)window.Frame;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());

var windowFrame = (IVsWindowFrame)window.Frame;
Microsoft.VisualStudio.ErrorHandler.ThrowOnFailure(windowFrame.Show());
VsixTelemetry.LogInformation("Couchbase Explorer tool window shown");
}
catch (Exception ex)
{
activity?.RecordError(ex);
VsixTelemetry.TrackException(ex, new Dictionary<string, object>
{
{ "operation.name", "ShowToolWindow" }
});
throw;
}
}
}
}
7 changes: 7 additions & 0 deletions src/CodingWithCalvin.CouchbaseExplorer/HoneycombConfig.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace CodingWithCalvin.CouchbaseExplorer
{
internal static class HoneycombConfig
{
public const string ApiKey = "PLACEHOLDER";
}
}
Loading