Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main' into test/unit-tests-on-net-7
Browse files Browse the repository at this point in the history
  • Loading branch information
tippmar-nr committed Jul 18, 2023
2 parents d336e16 + 561897d commit da7f99a
Show file tree
Hide file tree
Showing 4 changed files with 82 additions and 9 deletions.
20 changes: 20 additions & 0 deletions src/Agent/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,26 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [10.13.0](https://github.com/newrelic/newrelic-dotnet-agent/compare/v10.12.1...v10.13.0) (2023-07-14)


### Security

* Update Grpc.Net.Client library to address Dependabot alerts. ([#1768](https://github.com/newrelic/newrelic-dotnet-agent/issues/1768)) ([#1769](https://github.com/newrelic/newrelic-dotnet-agent/issues/1769)) ([eee7564](https://github.com/newrelic/newrelic-dotnet-agent/commit/eee7564cbe79b653ad7909af36f09c9a64cdb731))


### New Features

* Add support for filtering log events based on a list of log levels so that they are not forwarded to New Relic. Also adds new logging metrics to count the total number of filtered log events (Logging/denied). Refer to our [application logging configuration](https://docs.newrelic.com/docs/apm/agents/net-agent/configuration/net-agent-configuration/#application_logging) documentation for more details. ([#1760](https://github.com/newrelic/newrelic-dotnet-agent/issues/1760)) ([#1761](https://github.com/newrelic/newrelic-dotnet-agent/issues/1761)) ([#1762](https://github.com/newrelic/newrelic-dotnet-agent/issues/1762)) ([#1766](https://github.com/newrelic/newrelic-dotnet-agent/issues/1766)) ([aadce3a](https://github.com/newrelic/newrelic-dotnet-agent/commit/aadce3a09f9fe3c77a93f557686f1ddc26fc6169))
* Instrument OpenAsync() for SQL libraries. ([#1725](https://github.com/newrelic/newrelic-dotnet-agent/issues/1725)) ([a695ce6](https://github.com/newrelic/newrelic-dotnet-agent/commit/a695ce6de7e56bc3f803c9b9f6c8c09b30c106fd))


### Fixes

* Refactor StackExchange.Redis v2+ instrumentation to eliminate potential memory leaks. ([902b025](https://github.com/newrelic/newrelic-dotnet-agent/commit/902b025c8c420b8bc288b15d914b47aabc1bd426))
* Remove invalid trailing comma added to W3C tracestate header. ([#1779](https://github.com/newrelic/newrelic-dotnet-agent/issues/1779)) ([790a3b7](https://github.com/newrelic/newrelic-dotnet-agent/commit/790a3b75dd7609d76638ea3625a9289f58b24378))
* Update the MSI UI to clean up formatting and readability issues. ([#1748](https://github.com/newrelic/newrelic-dotnet-agent/issues/1748)) ([3fbc543](https://github.com/newrelic/newrelic-dotnet-agent/commit/3fbc54310ed3989f915e6f39b27ef8867ed573db))

## [10.12.1](https://github.com/newrelic/newrelic-dotnet-agent/compare/v10.12.0...v10.12.1) (2023-06-26)


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using NewRelic.Core.Logging;
using System;
using System.Collections.Generic;
using System.Linq;

namespace NewRelic.Agent.Core.DistributedTracing
{
Expand Down Expand Up @@ -162,12 +163,15 @@ private string BuildTracestate(IInternalTransaction transaction, DateTime timest
var newRelicTracestate = $"{accountKey}@nr={version}-{parentType}-{parentAccountId}-{appId}-{spanId}-{transactionId}-{sampled}-{priority}-{timestampInMillis}";
var otherVendorTracestates = string.Empty;

if (transaction.TracingState != null)
if (transaction.TracingState?.VendorStateEntries != null && transaction.TracingState.VendorStateEntries.Any())
{
if (transaction.TracingState.VendorStateEntries != null)
{
otherVendorTracestates = string.Join(",", transaction.TracingState.VendorStateEntries);
}
otherVendorTracestates = string.Join(",", transaction.TracingState.VendorStateEntries);
}

// If otherVendorTracestates is null/empty we get a trailing comma.
if (string.IsNullOrWhiteSpace(otherVendorTracestates))
{
return newRelicTracestate;
}

return string.Join(",", newRelicTracestate, otherVendorTracestates);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,11 +124,11 @@
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.0" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.9" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.9" Condition="'$(TargetFramework)' == 'net48'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.1.1" Condition="'$(TargetFramework)' == 'net481'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.1.3" Condition="'$(TargetFramework)' == 'net481'" />

<!-- Elastic.Clients.Elasticsearch .NET/Core references - only actually testing oldest and newest -->
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.0.0" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.1.1" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="Elastic.Clients.Elasticsearch" Version="8.1.3" Condition="'$(TargetFramework)' == 'net7.0'" />

<!-- Serilog .NET framework references -->
<PackageReference Include="Serilog" Version="1.5.14" Condition="'$(TargetFramework)' == 'net462'" />
Expand Down Expand Up @@ -233,12 +233,12 @@

<ItemGroup> <!-- Versions below 4.5 did not support netstandard 2.0 -->
<PackageReference Include="NLog" Version="4.5.9" Condition="'$(TargetFramework)' == 'net6.0'" />
<PackageReference Include="NLog" Version="5.2.0" Condition="'$(TargetFramework)' == 'net7.0'" />
<PackageReference Include="NLog" Version="5.2.2" Condition="'$(TargetFramework)' == 'net7.0'" />

<PackageReference Include="NLog" Version="4.3.11" Condition="'$(TargetFramework)' == 'net462'" />
<PackageReference Include="NLog" Version="4.1.2" Condition="'$(TargetFramework)' == 'net471'" />
<PackageReference Include="NLog" Version="4.5.11" Condition="'$(TargetFramework)' == 'net48'" />
<PackageReference Include="NLog" Version="5.2.0" Condition="'$(TargetFramework)' == 'net481'" />
<PackageReference Include="NLog" Version="5.2.2" Condition="'$(TargetFramework)' == 'net481'" />
</ItemGroup>

<ItemGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1031,6 +1031,55 @@ public void TraceIdShouldBeSameForAllSpansWhenNoTraceIdReceived()

#endregion TraceID Tests

[TestCase(true)]
[TestCase(true, "")]
[TestCase(true, "k1=v1", "k2=v2")]
[TestCase(false)]
[TestCase(false, "")]
[TestCase(false, "k1=v1", "k2=v2")]
public void W3C_BuildTracestate_EmptyVendors_NoCommas(bool hasIncomingPayload, params string[] vendorState)
{
// Arrange
Mock.Arrange(() => _configuration.SpanEventsEnabled).Returns(true);
Mock.Arrange(() => _configuration.PayloadSuccessMetricsEnabled).Returns(true);

var transaction = BuildMockTransaction(hasIncomingPayload: hasIncomingPayload, sampled: true);

var transactionGuid = GuidGenerator.GenerateNewRelicGuid();
Mock.Arrange(() => transaction.Guid).Returns(transactionGuid);

var expectedSpanGuid = GuidGenerator.GenerateNewRelicGuid();
var segment = Mock.Create<ISegment>();
Mock.Arrange(() => segment.SpanId).Returns(expectedSpanGuid);

Mock.Arrange(() => transaction.CurrentSegment).Returns(segment);

var headers = new List<KeyValuePair<string, string>>();
var setHeaders = new Action<List<KeyValuePair<string, string>>, string, string>((carrier, key, value) =>
{
carrier.Add(new KeyValuePair<string, string>(key, value));
});

var tracingState = Mock.Create<ITracingState>();

var vendorStateEntries = vendorState.ToList();

Mock.Arrange(() => tracingState.VendorStateEntries).Returns(vendorStateEntries);
Mock.Arrange(() => transaction.TracingState).Returns(tracingState);

Mock.Arrange(() => transaction.InsertDistributedTraceHeaders(
Arg.IsAny<List<KeyValuePair<string, string>>>(),
Arg.IsAny<Action<List<KeyValuePair<string, string>>, string, string>>()))
.DoInstead(() => _distributedTracePayloadHandler.InsertDistributedTraceHeaders(transaction, headers, setHeaders));

// Act
transaction.InsertDistributedTraceHeaders(headers, setHeaders);

var tracestateHeaderValue = headers.Where(header => header.Key == TracestateHeaderName).Select(header => header.Value).FirstOrDefault();

Assert.That(!tracestateHeaderValue.EndsWith(","), "W3C Tracestate string has a trailing comma.");
}

#endregion

#region Supportability Metrics
Expand Down

0 comments on commit da7f99a

Please sign in to comment.