Skip to content

Commit

Permalink
Getting property values: fix potential cache key conflict, improve sp…
Browse files Browse the repository at this point in the history
…eed (DataDog#642)
  • Loading branch information
lucaspimentel authored Feb 20, 2020
1 parent 491a637 commit 0ee897a
Show file tree
Hide file tree
Showing 29 changed files with 621 additions and 89 deletions.
74 changes: 14 additions & 60 deletions .azure-pipelines/integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,15 @@ jobs:
packageType: sdk
version: 3.1.x

- task: DotNetCoreCLI@2
displayName: dotnet build src/**/*.csproj
- task: NuGetToolInstaller@1
displayName: install nuget

- task: NuGetCommand@2
displayName: nuget restore
inputs:
command: build
projects: |
src/**/*.csproj
arguments: --configuration $(buildConfiguration)
restoreSolution: Datadog.Trace.sln
vstsFeed: $(packageFeed)
verbosityRestore: Normal

- task: DotNetCoreCLI@2
displayName: dotnet publish Datadog.Trace.ClrProfiler.Managed --framework net45
Expand Down Expand Up @@ -185,12 +187,12 @@ jobs:
projects: src/Datadog.Trace.ClrProfiler.Managed/Datadog.Trace.ClrProfiler.Managed.csproj
arguments: --configuration $(buildConfiguration) --framework netstandard2.0 --output $(publishOutput)/netstandard2.0

- task: NuGetCommand@2
displayName: nuget restore native
- task: DotNetCoreCLI@2
displayName: dotnet build Datadog.Trace.ClrProfiler.Managed.Loader
inputs:
restoreSolution: Datadog.Trace.Native.sln
vstsFeed: $(packageFeed)
verbosityRestore: Normal
command: build
projects: src/Datadog.Trace.ClrProfiler.Managed.Loader/Datadog.Trace.ClrProfiler.Managed.Loader.csproj
arguments: --configuration $(buildConfiguration)

- task: MSBuild@1
displayName: msbuild native
Expand All @@ -201,14 +203,6 @@ jobs:
msbuildArguments: /t:BuildCpp
maximumCpuCount: true

- task: NuGetCommand@2
displayName: 'nuget restore reproductions/**/packages.config'
inputs:
restoreSolution: reproductions/**/packages.config
restoreDirectory: $(Build.SourcesDirectory)/packages
vstsFeed: $(packageFeed)
verbosityRestore: Normal

- task: MSBuild@1
displayName: 'Build .NET Framework projects (not SDK-based projects)'
inputs:
Expand All @@ -218,20 +212,6 @@ jobs:
msbuildArguments: '/t:BuildFrameworkReproductions'
maximumCpuCount: true

- task: DotNetCoreCLI@2
displayName: dotnet restore
inputs:
command: restore
projects: |
reproductions/**/*.csproj
samples/**/*.csproj
test/Datadog.Trace.IntegrationTests/Datadog.Trace.IntegrationTests.csproj
test/Datadog.Trace.ClrProfiler.IntegrationTests/Datadog.Trace.ClrProfiler.IntegrationTests.csproj
test/Datadog.Trace.OpenTracing.IntegrationTests/Datadog.Trace.OpenTracing.IntegrationTests.csproj
!reproductions/**/ExpenseItDemo*.csproj
!reproductions/**/EntityFramework6x*.csproj
vstsFeed: $(packageFeed)

- task: DotNetCoreCLI@2
displayName: dotnet build integration tests
inputs:
Expand All @@ -244,35 +224,9 @@ jobs:
test/Datadog.Trace.OpenTracing.IntegrationTests/Datadog.Trace.OpenTracing.IntegrationTests.csproj
!reproductions/**/ExpenseItDemo*.csproj
!reproductions/**/EntityFramework6x*.csproj
!reproductions/**/StackExchange.Redis.AssemblyConflict.LegacyProject.csproj
arguments: --configuration $(buildConfiguration) -p:Platform=$(buildPlatform) -p:ManagedProfilerOutputDirectory=$(publishOutput)

# - task: MSBuild@1
# displayName: 'Build sample apps (x64 or x86)'
# inputs:
# solution: Datadog.Trace.proj
# platform: '$(buildPlatform)'
# configuration: '$(buildConfiguration)'
# msbuildArguments: '/t:BuildSamples'
# maximumCpuCount: true

# - script: |
# choco install redis-64
# redis-server --service-install
# redis-server --service-start
# displayName: 'Install Redis'

# - script: |
# choco install elasticsearch
# net start elasticsearch-service-x64
# displayName: 'Install Elasticsearch'

# - task: PowerShell@2
# displayName: 'PowerShell Script'
# inputs:
# targetType: filePath
# filePath: './ci/install-sqlserver.ps1'
# enabled: false

- task: DotNetCoreCLI@2
displayName: dotnet test
inputs:
Expand Down
1 change: 1 addition & 0 deletions Datadog.Trace.proj
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

<ItemGroup>
<FrameworkReproduction Include="reproductions\EntityFramework6x.MdTokenLookupFailure\EntityFramework6x.MdTokenLookupFailure.csproj" />
<FrameworkReproduction Include="reproductions\StackExchange.Redis.AssemblyConflict.LegacyProject\StackExchange.Redis.AssemblyConflict.LegacyProject.csproj" />
</ItemGroup>

<Import Condition="'$(PerformComprehensiveTesting)'=='true'" Project="PackageVersionsComprehensive.g.props" />
Expand Down
73 changes: 73 additions & 0 deletions Datadog.Trace.sln
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,16 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.FakeKudu", "samples
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Samples.FakeAzureAppServices", "samples\Samples.FakeAzureAppServices\Samples.FakeAzureAppServices.csproj", "{9A2AE41B-251F-4A21-89FA-E5C55A737BBB}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.StackExchange.Redis.Abstractions", "reproduction-dependencies\Datadog.StackExchange.Redis.Abstractions\Datadog.StackExchange.Redis.Abstractions.csproj", "{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.StackExchange.Redis", "reproduction-dependencies\Datadog.StackExchange.Redis\Datadog.StackExchange.Redis.csproj", "{EB0B88E2-589A-4F65-8F98-D5B958D8104F}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Datadog.StackExchange.Redis.StrongName", "reproduction-dependencies\Datadog.StackExchange.Redis.StrongName\Datadog.StackExchange.Redis.StrongName.csproj", "{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StackExchange.Redis.AssemblyConflict.LegacyProject", "reproductions\StackExchange.Redis.AssemblyConflict.LegacyProject\StackExchange.Redis.AssemblyConflict.LegacyProject.csproj", "{7B0822F6-80DE-4B49-8125-93975678D0D5}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "StackExchange.Redis.AssemblyConflict.SdkProject", "reproductions\StackExchange.Redis.AssemblyConflict.SdkProject\StackExchange.Redis.AssemblyConflict.SdkProject.csproj", "{C41023C9-65C3-4FB3-9053-4DE963A81500}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -1025,6 +1035,64 @@ Global
{9A2AE41B-251F-4A21-89FA-E5C55A737BBB}.Release|x64.Build.0 = Release|x64
{9A2AE41B-251F-4A21-89FA-E5C55A737BBB}.Release|x86.ActiveCfg = Release|x86
{9A2AE41B-251F-4A21-89FA-E5C55A737BBB}.Release|x86.Build.0 = Release|x86
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|Any CPU.Build.0 = Debug|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|x64.ActiveCfg = Debug|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|x64.Build.0 = Debug|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|x86.ActiveCfg = Debug|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Debug|x86.Build.0 = Debug|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Release|Any CPU.ActiveCfg = Release|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Release|Any CPU.Build.0 = Release|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Release|x64.ActiveCfg = Release|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Release|x64.Build.0 = Release|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Release|x86.ActiveCfg = Release|Any CPU
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE}.Release|x86.Build.0 = Release|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Debug|Any CPU.Build.0 = Debug|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Debug|x64.ActiveCfg = Debug|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Debug|x64.Build.0 = Debug|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Debug|x86.ActiveCfg = Debug|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Debug|x86.Build.0 = Debug|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Release|Any CPU.ActiveCfg = Release|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Release|Any CPU.Build.0 = Release|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Release|x64.ActiveCfg = Release|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Release|x64.Build.0 = Release|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Release|x86.ActiveCfg = Release|Any CPU
{EB0B88E2-589A-4F65-8F98-D5B958D8104F}.Release|x86.Build.0 = Release|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Debug|Any CPU.Build.0 = Debug|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Debug|x64.ActiveCfg = Debug|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Debug|x64.Build.0 = Debug|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Debug|x86.ActiveCfg = Debug|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Debug|x86.Build.0 = Debug|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Release|Any CPU.ActiveCfg = Release|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Release|Any CPU.Build.0 = Release|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Release|x64.ActiveCfg = Release|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Release|x64.Build.0 = Release|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Release|x86.ActiveCfg = Release|Any CPU
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630}.Release|x86.Build.0 = Release|Any CPU
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Debug|x64.ActiveCfg = Debug|x64
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Debug|x64.Build.0 = Debug|x64
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Debug|x86.ActiveCfg = Debug|x86
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Debug|x86.Build.0 = Debug|x86
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Release|Any CPU.Build.0 = Release|Any CPU
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Release|x64.ActiveCfg = Release|x64
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Release|x64.Build.0 = Release|x64
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Release|x86.ActiveCfg = Release|x86
{7B0822F6-80DE-4B49-8125-93975678D0D5}.Release|x86.Build.0 = Release|x86
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Debug|Any CPU.ActiveCfg = Debug|x86
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Debug|x64.ActiveCfg = Debug|x64
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Debug|x64.Build.0 = Debug|x64
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Debug|x86.ActiveCfg = Debug|x86
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Debug|x86.Build.0 = Debug|x86
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Release|Any CPU.ActiveCfg = Release|x86
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Release|x64.ActiveCfg = Release|x64
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Release|x64.Build.0 = Release|x64
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Release|x86.ActiveCfg = Release|x86
{C41023C9-65C3-4FB3-9053-4DE963A81500}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down Expand Up @@ -1099,6 +1167,11 @@ Global
{DAA6B000-5BED-4081-B5E0-B698BFB89415} = {5D8E1F81-B820-4736-B797-271B0FE787EE}
{317D3C64-E4F6-4D77-83C0-C69FC3923471} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{9A2AE41B-251F-4A21-89FA-E5C55A737BBB} = {AA6F5582-3B71-49AC-AA39-8F7815AC46BE}
{24BE488C-A5F3-4228-8CAB-E60EBEA444EE} = {641C9C61-53FD-4504-B8D9-84008BDB89D1}
{EB0B88E2-589A-4F65-8F98-D5B958D8104F} = {641C9C61-53FD-4504-B8D9-84008BDB89D1}
{4E83BFB5-F225-4C3B-B96E-0AD1951A5630} = {641C9C61-53FD-4504-B8D9-84008BDB89D1}
{7B0822F6-80DE-4B49-8125-93975678D0D5} = {550AE553-2BBB-4021-B55A-137EF31A6B1F}
{C41023C9-65C3-4FB3-9053-4DE963A81500} = {550AE553-2BBB-4021-B55A-137EF31A6B1F}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {160A1D00-1F5B-40F8-A155-621B4459D78F}
Expand Down
2 changes: 1 addition & 1 deletion docker/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ for sample in Samples.Elasticsearch Samples.Elasticsearch.V5 Samples.ServiceStac
dotnet publish -f $publishTargetFramework -c $buildConfiguration samples/$sample/$sample.csproj -p:Configuration=$buildConfiguration -p:ManagedProfilerOutputDirectory="$PUBLISH_OUTPUT"
done

for sample in OrleansCrash DataDogThreadTest HttpMessageHandler.StackOverflowException StackExchange.Redis.StackOverflowException AspNetMvcCorePerformance AssemblyLoad.FileNotFoundException TraceContext.InvalidOperationException AssemblyResolveMscorlibResources.InfiniteRecursionCrash ; do
for sample in OrleansCrash DataDogThreadTest HttpMessageHandler.StackOverflowException StackExchange.Redis.StackOverflowException AspNetMvcCorePerformance AssemblyLoad.FileNotFoundException TraceContext.InvalidOperationException AssemblyResolveMscorlibResources.InfiniteRecursionCrash StackExchange.Redis.AssemblyConflict.SdkProject ; do
dotnet publish -f $publishTargetFramework -c $buildConfiguration reproductions/$sample/$sample.csproj -p:Configuration=$buildConfiguration -p:ManagedProfilerOutputDirectory="$PUBLISH_OUTPUT"
done

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
</PropertyGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<!--
This file intentionally left blank...
to stop msbuild from looking up the folder hierarchy
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
namespace Datadog.StackExchange.Redis.Abstractions
{
public interface ICache
{
string GetString(string key);

void SetString(string key, string value);
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StackExchange.Redis.StrongName" Version="1.2.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Datadog.StackExchange.Redis.Abstractions\Datadog.StackExchange.Redis.Abstractions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<!--
This file intentionally left blank...
to stop msbuild from looking up the folder hierarchy
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using Datadog.StackExchange.Redis.Abstractions;
using StackExchange.Redis;

namespace Datadog.StackExchange.Redis.StrongName
{
public class RedisStrongNameClient : ICache, IDisposable
{
private readonly ConnectionMultiplexer _connection;
private readonly IDatabase _database;

public RedisStrongNameClient(string configuration)
{
_connection = ConnectionMultiplexer.Connect(configuration);
_database = _connection.GetDatabase();
}

public void SetString(string key, string value)
{
_database.StringSet(key, value);
}

public string GetString(string key)
{
return _database.StringGet(key);
}

public void Dispose()
{
_connection?.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Library</OutputType>
<TargetFrameworks>net45;netstandard2.0</TargetFrameworks>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="StackExchange.Redis" Version="1.2.6" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\Datadog.StackExchange.Redis.Abstractions\Datadog.StackExchange.Redis.Abstractions.csproj" />
</ItemGroup>

</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<!--
This file intentionally left blank...
to stop msbuild from looking up the folder hierarchy
-->
</Project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
using System;
using Datadog.StackExchange.Redis.Abstractions;
using StackExchange.Redis;

namespace Datadog.StackExchange.Redis
{
public class RedisClient : ICache, IDisposable
{
private readonly ConnectionMultiplexer _connection;
private readonly IDatabase _database;

public RedisClient(string configuration)
{
_connection = ConnectionMultiplexer.Connect(configuration);
_database = _connection.GetDatabase();
}

public void SetString(string key, string value)
{
_database.StringSet(key, value);
}

public string GetString(string key)
{
return _database.StringGet(key);
}

public void Dispose()
{
_connection?.Dispose();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5"/>
</startup>
</configuration>
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<Project>
<!--
This file intentionally left blank...
to stop msbuild from looking up the folder hierarchy
-->
</Project>
Loading

0 comments on commit 0ee897a

Please sign in to comment.