Skip to content

Commit 27a78cb

Browse files
authored
feat: Update CosmosDB instrumentation to support latest version (#2832)
1 parent 4798dc7 commit 27a78cb

File tree

4 files changed

+32
-5
lines changed

4 files changed

+32
-5
lines changed

src/Agent/NewRelic/Agent/Extensions/Providers/Wrapper/CosmosDb/Instrumentation.xml

+5
Original file line numberDiff line numberDiff line change
@@ -15,5 +15,10 @@ SPDX-License-Identifier: Apache-2.0
1515
<exactMethodMatcher methodName="ExecuteItemQueryAsync" parameters="System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,System.Guid,Microsoft.Azure.Cosmos.FeedRange,Microsoft.Azure.Cosmos.QueryRequestOptions,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.String,System.Boolean,System.Int32,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken" />
1616
</match>
1717
</tracerFactory>
18+
<tracerFactory name="ExecuteItemQueryAsyncWrapper">
19+
<match assemblyName="Microsoft.Azure.Cosmos.Client" className="Microsoft.Azure.Cosmos.CosmosQueryClientCore">
20+
<exactMethodMatcher methodName="ExecuteItemQueryAsync" parameters="System.String,Microsoft.Azure.Documents.ResourceType,Microsoft.Azure.Documents.OperationType,Microsoft.Azure.Cosmos.FeedRange,Microsoft.Azure.Cosmos.QueryRequestOptions,Microsoft.Azure.Cosmos.Query.Core.AdditionalRequestHeaders,Microsoft.Azure.Cosmos.Query.Core.SqlQuerySpec,System.String,System.Int32,Microsoft.Azure.Cosmos.Tracing.ITrace,System.Threading.CancellationToken" />
21+
</match>
22+
</tracerFactory>
1823
</instrumentation>
1924
</extension>

tests/Agent/IntegrationTests/SharedApplications/Common/MFALatestPackages/MFALatestPackages.csproj

+3
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,9 @@
88
<PackageReference Include="AWSSDK.BedrockRuntime" Version="3.7.404.5" Condition="'$(TargetFramework)' == 'net481'" />
99
<PackageReference Include="AWSSDK.BedrockRuntime" Version="3.7.404.5" Condition="'$(TargetFramework)' == 'net8.0'" />
1010

11+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.44.0" Condition="'$(TargetFramework)' == 'net481'" />
12+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.44.0" Condition="'$(TargetFramework)' == 'net8.0'" />
13+
1114
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.8" Condition="'$(TargetFramework)' == 'net481'" />
1215
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.15.8" Condition="'$(TargetFramework)' == 'net8.0'" />
1316

tests/Agent/IntegrationTests/SharedApplications/Common/MultiFunctionApplicationHelpers/MultiFunctionApplicationHelpers.csproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,10 @@
183183
</ItemGroup>
184184

185185
<ItemGroup>
186-
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.23.0" />
186+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.23.0" Condition="'$(TargetFramework)' == 'net462'" />
187+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.23.0" Condition="'$(TargetFramework)' == 'net471'" />
188+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.23.0" Condition="'$(TargetFramework)' == 'net48'" />
189+
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.23.0" Condition="'$(TargetFramework)' == 'net6.0'" />
187190
</ItemGroup>
188191

189192
<ItemGroup>

tests/Agent/IntegrationTests/UnboundedIntegrationTests/CosmosDB/CosmosDBTests.cs

+20-4
Original file line numberDiff line numberDiff line change
@@ -251,24 +251,40 @@ public void CreateAndExecuteStoredProcTests()
251251
}
252252
}
253253

254+
[NetFrameworkTest]
255+
public class CosmosDBTestsFW462 : CosmosDBTestsBase<ConsoleDynamicMethodFixtureFW462>
256+
{
257+
public CosmosDBTestsFW462(ConsoleDynamicMethodFixtureFW462 fixture, ITestOutputHelper output)
258+
: base(fixture, output)
259+
{
260+
}
261+
}
254262

255263
[NetFrameworkTest]
256-
public class CosmosDBTestsFW : CosmosDBTestsBase<ConsoleDynamicMethodFixtureFWLatest>
264+
public class CosmosDBTestsFWLatest : CosmosDBTestsBase<ConsoleDynamicMethodFixtureFWLatest>
257265
{
258-
public CosmosDBTestsFW(ConsoleDynamicMethodFixtureFWLatest fixture, ITestOutputHelper output)
266+
public CosmosDBTestsFWLatest(ConsoleDynamicMethodFixtureFWLatest fixture, ITestOutputHelper output)
259267
: base(fixture, output)
260268
{
261269
}
262270
}
263271

264272

265273
[NetCoreTest]
266-
public class CosmosDBTestsCore : CosmosDBTestsBase<ConsoleDynamicMethodFixtureCoreOldest>
274+
public class CosmosDBTestsCoreOldest : CosmosDBTestsBase<ConsoleDynamicMethodFixtureCoreOldest>
267275
{
268-
public CosmosDBTestsCore(ConsoleDynamicMethodFixtureCoreOldest fixture, ITestOutputHelper output)
276+
public CosmosDBTestsCoreOldest(ConsoleDynamicMethodFixtureCoreOldest fixture, ITestOutputHelper output)
269277
: base(fixture, output)
270278
{
271279
}
272280
}
273281

282+
[NetCoreTest]
283+
public class CosmosDBTestsCoreLatest : CosmosDBTestsBase<ConsoleDynamicMethodFixtureCoreLatest>
284+
{
285+
public CosmosDBTestsCoreLatest(ConsoleDynamicMethodFixtureCoreLatest fixture, ITestOutputHelper output)
286+
: base(fixture, output)
287+
{
288+
}
289+
}
274290
}

0 commit comments

Comments
 (0)