Skip to content

Commit

Permalink
nuget.org preparation (#1)
Browse files Browse the repository at this point in the history
  • Loading branch information
nyusti committed May 30, 2018
1 parent cd10929 commit e53c11e
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 26 deletions.
7 changes: 7 additions & 0 deletions readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@ On sending a message a Dependency call telemetry will be registered, on receivin
* [Use message scope explicitly](#use-message-scope)
* [Implementation notes](#implementation-notes)

## Build status and NuGet

![build status](https://dealogic.visualstudio.com/DefaultCollection/_apis/public/build/definitions/4cd19643-db3a-4dcc-b481-76a7800dd64d/13165/badge)

Download nuget from [Link](https://www.nuget.org/packages/Dealogic.ServiceBus.Azure.ApplicationInsights/)


### <a id="send-a-message" /> Send a message to a Service Bus entity

Use the `SendMessageAsync` extension method (or the sync version) on the `ServiceBusTelemetryHelper` instance.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" />
<Import Project="..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.props" Condition="Exists('..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
Expand Down Expand Up @@ -47,8 +47,8 @@
<Reference Include="Castle.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=407dd0808d44fbdc, processorArchitecture=MSIL">
<HintPath>..\..\packages\Castle.Core.4.2.1\lib\net45\Castle.Core.dll</HintPath>
</Reference>
<Reference Include="Microsoft.ApplicationInsights, Version=2.5.1.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.2.5.1\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
<Reference Include="Microsoft.ApplicationInsights, Version=2.6.4.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.ApplicationInsights.2.6.4\lib\net46\Microsoft.ApplicationInsights.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Azure.Amqp, Version=2.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.Azure.Amqp.2.1.2\lib\net45\Microsoft.Azure.Amqp.dll</HintPath>
Expand All @@ -58,10 +58,10 @@
</Reference>
<Reference Include="Microsoft.CSharp" />
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
<HintPath>..\..\packages\MSTest.TestFramework.1.3.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.dll</HintPath>
</Reference>
<Reference Include="Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\MSTest.TestFramework.1.2.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
<HintPath>..\..\packages\MSTest.TestFramework.1.3.1\lib\net45\Microsoft.VisualStudio.TestPlatform.TestFramework.Extensions.dll</HintPath>
</Reference>
<Reference Include="NSubstitute, Version=3.1.0.0, Culture=neutral, PublicKeyToken=92dd2e9066daa5ca, processorArchitecture=MSIL">
<HintPath>..\..\packages\NSubstitute.3.1.0\lib\net46\NSubstitute.dll</HintPath>
Expand All @@ -72,6 +72,7 @@
<Reference Include="System.Diagnostics.DiagnosticSource, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Diagnostics.DiagnosticSource.4.4.0\lib\net46\System.Diagnostics.DiagnosticSource.dll</HintPath>
</Reference>
<Reference Include="System.Net.Http, Version=4.2.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
<Reference Include="System.Net.WebSockets, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Net.WebSockets.4.0.0\lib\net46\System.Net.WebSockets.dll</HintPath>
<Private>True</Private>
Expand Down Expand Up @@ -130,8 +131,8 @@
<PropertyGroup>
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
</PropertyGroup>
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets'))" />
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.props')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.props'))" />
<Error Condition="!Exists('..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.targets'))" />
</Target>
<Import Project="..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\packages\MSTest.TestAdapter.1.2.1\build\net45\MSTest.TestAdapter.targets')" />
<Import Project="..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.targets" Condition="Exists('..\..\packages\MSTest.TestAdapter.1.3.1\build\net45\MSTest.TestAdapter.targets')" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Castle.Core" version="4.2.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.5.1" targetFramework="net461" />
<package id="Microsoft.ApplicationInsights" version="2.6.4" targetFramework="net461" />
<package id="Microsoft.Azure.Amqp" version="2.1.2" targetFramework="net461" />
<package id="Microsoft.Azure.ServiceBus" version="2.0.0" targetFramework="net461" />
<package id="MSTest.TestAdapter" version="1.2.1" targetFramework="net461" />
<package id="MSTest.TestFramework" version="1.2.1" targetFramework="net461" />
<package id="MSTest.TestAdapter" version="1.3.1" targetFramework="net461" />
<package id="MSTest.TestFramework" version="1.3.1" targetFramework="net461" />
<package id="NSubstitute" version="3.1.0" targetFramework="net461" />
<package id="System.Diagnostics.DiagnosticSource" version="4.4.0" targetFramework="net461" />
<package id="System.Net.WebSockets" version="4.0.0" targetFramework="net461" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>netstandard2.0;net461</TargetFrameworks>
<TargetFramework>netstandard2.0</TargetFramework>
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>dealogic.snk</AssemblyOriginatorKeyFile>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<Authors>Dealogic, Team Lambda</Authors>
<Company>Dealogic</Company>
<Description>Service Bus Application Insights helper classes. For usage please see readme.md in the repository.</Description>
Expand All @@ -24,7 +24,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.5.1" />
<PackageReference Include="Microsoft.ApplicationInsights" Version="2.6.4" />
<PackageReference Include="microsoft.azure.servicebus" Version="2.0.0" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ protected virtual void Dispose(bool disposing)
{
this.telemetryClient.StopOperation(this.operationHolder);
this.operationHolder.Dispose();
GC.SuppressFinalize(this);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ protected virtual void Dispose(bool disposing)
{
this.telemetryClient.StopOperation(this.operationHolder);
this.operationHolder.Dispose();
GC.SuppressFinalize(this);
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public class ServiceBusTelemetryHelper : IServiceBusTelemetryHelper
/// </summary>
public const string EnqueueOperationName = "Enqueue";

private readonly TelemetryClient telemetryClient;
private readonly Uri endpointUri;

/// <summary>
Expand Down Expand Up @@ -60,13 +59,13 @@ public ServiceBusTelemetryHelper(string serviceBusConnectionString, TelemetryCli
throw new ArgumentException("Service Bus connection string is null or empty.", nameof(serviceBusConnectionString));
}

this.telemetryClient = telemetryClient ?? new TelemetryClient();
this.TelemetryClient = telemetryClient ?? new TelemetryClient();
var connectionStringBuilder = new ServiceBusConnectionStringBuilder(serviceBusConnectionString);
this.endpointUri = new Uri(connectionStringBuilder.Endpoint);
}

/// <inheritdoc/>
public TelemetryClient TelemetryClient => telemetryClient;
public TelemetryClient TelemetryClient { get; }

/// <inheritdoc/>
public bool TrackException { get; set; } = true;
Expand All @@ -85,7 +84,7 @@ public IMessageScope BeginMessageSendingScope(Message brokeredMessage, string en
throw new ArgumentException("Entity path is null or empty.", nameof(entityPath));
}

var operation = this.telemetryClient.StartOperation<DependencyTelemetry>($"{EnqueueOperationName} {entityPath}");
var operation = this.TelemetryClient.StartOperation<DependencyTelemetry>($"{EnqueueOperationName} {entityPath}");
operation.Telemetry.Type = "Queue";
operation.Telemetry.Target = $"{this.endpointUri.Host}/{entityPath}";
operation.Telemetry.Data = EnqueueOperationName;
Expand All @@ -94,7 +93,7 @@ public IMessageScope BeginMessageSendingScope(Message brokeredMessage, string en
brokeredMessage.UserProperties.Add(ParentIdName, operation.Telemetry.Id);
brokeredMessage.UserProperties.Add(RootIdName, operation.Telemetry.Context.Operation.Id);

return new SendMessageScope(this.telemetryClient, operation);
return new SendMessageScope(this.TelemetryClient, operation);
}

/// <inheritdoc/>
Expand Down Expand Up @@ -132,9 +131,9 @@ public IMessageScope BeginMessageProcessingScope(Message brokeredMessage, string
requestTelemetry.Properties.Add(nameof(Message.MessageId), brokeredMessage.MessageId);
requestTelemetry.Url = new Uri($"{this.endpointUri.Host}/{entityPath}", UriKind.Relative);

var operation = this.telemetryClient.StartOperation(requestTelemetry);
var operation = this.TelemetryClient.StartOperation(requestTelemetry);

return new ProcessMessageScope(this.telemetryClient, operation);
return new ProcessMessageScope(this.TelemetryClient, operation);
}

/// <summary>
Expand All @@ -156,7 +155,7 @@ public IMessageScope BeginMessageSendingScope(IEnumerable<Message> messages, str
throw new ArgumentException("Entity path is null or empty.", nameof(entityPath));
}

var operation = this.telemetryClient.StartOperation<DependencyTelemetry>($"{EnqueueOperationName} {entityPath}");
var operation = this.TelemetryClient.StartOperation<DependencyTelemetry>($"{EnqueueOperationName} {entityPath}");
operation.Telemetry.Type = "Queue";
operation.Telemetry.Target = $"{this.endpointUri.Host}/{entityPath}";
operation.Telemetry.Data = EnqueueOperationName;
Expand All @@ -167,7 +166,7 @@ public IMessageScope BeginMessageSendingScope(IEnumerable<Message> messages, str
brokeredMessage.UserProperties.Add(RootIdName, operation.Telemetry.Context.Operation.Id);
}

return new SendMessageScope(this.telemetryClient, operation);
return new SendMessageScope(this.TelemetryClient, operation);
}
}
}

0 comments on commit e53c11e

Please sign in to comment.