Skip to content

Commit

Permalink
Merge branch 'main' into feat/streaming-tracelog
Browse files Browse the repository at this point in the history
  • Loading branch information
vaind committed Aug 16, 2023
2 parents 5b159e1 + 24b3902 commit f457e3a
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 77 deletions.
27 changes: 21 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,21 @@

## Unreleased

### Fixes

- The SDK no longer creates transactions with their start date set to `Jan 01, 001` ([#2544](https://github.com/getsentry/sentry-dotnet/pull/2544))

### Dependencies

- Bump CLI from v2.20.4 to v2.20.5 ([#2539](https://github.com/getsentry/sentry-dotnet/pull/2539))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2205)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.20.4...2.20.5)
- Bump Cocoa SDK from v8.9.4 to v8.9.5 ([#2542](https://github.com/getsentry/sentry-dotnet/pull/2542))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#895)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.9.4...8.9.5)

## 3.35.0

### Features

- Distributed tracing now works independently of the performance feature. This allows you to connect errors to other Sentry instrumented applications ([#2493](https://github.com/getsentry/sentry-dotnet/pull/2493))
Expand All @@ -22,12 +37,12 @@

### Dependencies

- Bump Java SDK from v6.25.1 to v6.27.0 ([#2484](https://github.com/getsentry/sentry-dotnet/pull/2484), [#2498](https://github.com/getsentry/sentry-dotnet/pull/2498), [#2517](https://github.com/getsentry/sentry-dotnet/pull/2517))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6270)
- [diff](https://github.com/getsentry/sentry-java/compare/6.25.1...6.27.0)
- Bump CLI from v2.19.4 to v2.20.3 ([#2509](https://github.com/getsentry/sentry-dotnet/pull/2509), [#2518](https://github.com/getsentry/sentry-dotnet/pull/2518), [#2527](https://github.com/getsentry/sentry-dotnet/pull/2527))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2203)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.19.4...2.20.3)
- Bump Java SDK from v6.25.1 to v6.28.0 ([#2484](https://github.com/getsentry/sentry-dotnet/pull/2484), [#2498](https://github.com/getsentry/sentry-dotnet/pull/2498), [#2517](https://github.com/getsentry/sentry-dotnet/pull/2517), [#2533](https://github.com/getsentry/sentry-dotnet/pull/2533))
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#6280)
- [diff](https://github.com/getsentry/sentry-java/compare/6.25.1...6.28.0)
- Bump CLI from v2.19.4 to v2.20.4 ([#2509](https://github.com/getsentry/sentry-dotnet/pull/2509), [#2518](https://github.com/getsentry/sentry-dotnet/pull/2518), [#2527](https://github.com/getsentry/sentry-dotnet/pull/2527), [#2530](https://github.com/getsentry/sentry-dotnet/pull/2530))
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2204)
- [diff](https://github.com/getsentry/sentry-cli/compare/2.19.4...2.20.4)
- Bump Cocoa SDK from v8.8.0 to v8.9.4 ([#2479](https://github.com/getsentry/sentry-dotnet/pull/2479), [#2483](https://github.com/getsentry/sentry-dotnet/pull/2483), [#2500](https://github.com/getsentry/sentry-dotnet/pull/2500), [#2510](https://github.com/getsentry/sentry-dotnet/pull/2510), [#2531](https://github.com/getsentry/sentry-dotnet/pull/2531))
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#894)
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.8.0...8.9.4)
Expand Down
4 changes: 2 additions & 2 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project>

<PropertyGroup>
<Version>3.34.0</Version>
<Version>3.35.0</Version>
<LangVersion>11</LangVersion>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AssemblyOriginatorKeyFile>$(MSBuildThisFileDirectory).assets\Sentry.snk</AssemblyOriginatorKeyFile>
Expand Down Expand Up @@ -100,7 +100,7 @@

<!-- Set the version and local path for Sentry CLI (downloaded in the restore phase of Sentry.csproj) -->
<PropertyGroup Condition="'$(SolutionName)' != 'Sentry.Unity'">
<SentryCLIVersion>2.20.3</SentryCLIVersion>
<SentryCLIVersion>2.20.5</SentryCLIVersion>
<SentryCLIDirectory>$(MSBuildThisFileDirectory)tools\sentry-cli\$(SentryCLIVersion)\</SentryCLIDirectory>
</PropertyGroup>

Expand Down
2 changes: 1 addition & 1 deletion modules/sentry-cocoa
Submodule sentry-cocoa updated 30 files
+5 −0 CHANGELOG.md
+4 −4 Samples/iOS-Swift/iOS-Swift.xcodeproj/project.pbxproj
+34 −20 Samples/iOS-Swift/iOS-Swift/Base.lproj/Main.storyboard
+62 −7 Samples/iOS-Swift/iOS-Swift/ViewController.swift
+1 −1 Samples/iOS-Swift/iOS-SwiftUITests/ProfilingUITests.swift
+2 −2 Sentry.podspec
+1 −1 SentryPrivate.podspec
+2 −2 SentrySwiftUI.podspec
+1 −1 Sources/Configuration/Sentry.xcconfig
+1 −1 Sources/Configuration/SentryPrivate.xcconfig
+27 −0 Sources/Sentry/PrivateSentrySDKOnly.m
+6 −7 Sources/Sentry/Profiling/SentryProfiledTracerConcurrency.mm
+3 −2 Sources/Sentry/SentryEvent.m
+1 −1 Sources/Sentry/SentryMeta.m
+11 −10 Sources/Sentry/SentryMetricProfiler.mm
+9 −13 Sources/Sentry/SentryProfileTimeseries.mm
+86 −60 Sources/Sentry/SentryProfiler.mm
+2 −2 Sources/Sentry/SentryTracer.m
+14 −0 Sources/Sentry/include/HybridPublic/PrivateSentrySDKOnly.h
+1 −0 Sources/Sentry/include/SentryInternalDefines.h
+3 −2 Sources/Sentry/include/SentryMetricProfiler.h
+1 −1 Sources/Sentry/include/SentryProfileTimeseries.h
+4 −4 Sources/Sentry/include/SentryProfiledTracerConcurrency.h
+5 −4 Sources/Sentry/include/SentryProfiler+Private.h
+9 −1 Sources/Sentry/include/SentryProfiler.h
+1 −1 Tests/HybridSDKTest/HybridPod.podspec
+7 −20 Tests/SentryProfilerTests/SentryProfilerTests.mm
+15 −15 Tests/SentryTests/Integrations/Performance/FramesTracking/SentryFramesTrackerTests.swift
+53 −24 Tests/SentryTests/PrivateSentrySDKOnlyTests.swift
+23 −1 develop-docs/README.md
2 changes: 1 addition & 1 deletion src/Sentry.Bindings.Android/Sentry.Bindings.Android.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<TargetFramework>net6.0-android</TargetFramework>
<!-- BG8605 and BG8606 happen because there's a missing androidx.lifecycle dependency, but we don't need it here. (The native Android Sentry SDK will use it if it exists.) -->
<NoWarn>$(NoWarn);BG8605;BG8606</NoWarn>
<SentryAndroidSdkVersion>6.27.0</SentryAndroidSdkVersion>
<SentryAndroidSdkVersion>6.28.0</SentryAndroidSdkVersion>
<SentryAndroidSdkDirectory>$(BaseIntermediateOutputPath)sdks\Sentry\Android\$(SentryAndroidSdkVersion)\</SentryAndroidSdkDirectory>
<Description>.NET Bindings for the Sentry Android SDK</Description>
</PropertyGroup>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ internal class SentryDiagnosticListenerIntegration : ISdkIntegration
{
public void Register(IHub hub, SentryOptions options)
{
if (!options.IsTracingEnabled)
if (!options.IsPerformanceMonitoringEnabled)
{
options.Log(SentryLevel.Info, "DiagnosticSource Integration is disabled because tracing is disabled.");
options.DisableDiagnosticSourceIntegration();
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry.EntityFramework/DbInterceptionIntegration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ internal class DbInterceptionIntegration : ISdkIntegration

public void Register(IHub hub, SentryOptions options)
{
if (!options.IsTracingEnabled)
if (!options.IsPerformanceMonitoringEnabled)
{
options.DiagnosticLogger?.LogInfo(SampleRateDisabledMessage);
}
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Platforms/Android/SentrySdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ private static void InitSentryAndroidSdk(SentryOptions options)
}

// These options we have behind feature flags
if (options is {IsTracingEnabled: true, Android.EnableAndroidSdkTracing: true})
if (options is {IsPerformanceMonitoringEnabled: true, Android.EnableAndroidSdkTracing: true})
{
o.EnableTracing = (JavaBoolean?)options.EnableTracing;
o.TracesSampleRate = (JavaDouble?)options.TracesSampleRate;
Expand Down
2 changes: 1 addition & 1 deletion src/Sentry/Platforms/iOS/SentrySdk.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private static void InitSentryCocoaSdk(SentryOptions options)
}

// These options we have behind feature flags
if (options is {IsTracingEnabled: true, iOS.EnableCocoaSdkTracing: true})
if (options is {IsPerformanceMonitoringEnabled: true, iOS.EnableCocoaSdkTracing: true})
{
if (options.EnableTracing != null)
{
Expand Down
14 changes: 7 additions & 7 deletions src/Sentry/Sentry.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -96,25 +96,25 @@
<ItemGroup>
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('OSX')) And $(_OSArchitecture) == 'Arm64')"
Include="sentry-cli-Darwin-arm64" FileHash="9b39ca8f6b633f971753c99b2742cfc4f29d84357e04e6ddf97ff436259f1d41" />
Include="sentry-cli-Darwin-arm64" FileHash="51910fee9a12f062e72eb4c3cfd52e57537a398da2634b50f83d1fcb2666b159" />
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('OSX')) And $(_OSArchitecture) == 'X64')"
Include="sentry-cli-Darwin-x86_64" FileHash="a260e81796edf73e54320c8d6bf1839bfe9be5a8781ccce7882b262200955bd2" />
Include="sentry-cli-Darwin-x86_64" FileHash="01bfff67c5b5f1981d885a9800ccef124596c657a4f0e5901b11e8e0cd2f327e" />
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'Arm64')"
Include="sentry-cli-Linux-aarch64" FileHash="fae5777deee53329b8c427fb9eda86bd4f01412b73d0d672b9485e6f95be0247" />
Include="sentry-cli-Linux-aarch64" FileHash="d111f436e48893dbf19e8894d48a5001a2d702fcec98af8dc0d45c7ee8d885cf" />
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'X86')"
Include="sentry-cli-Linux-i686" FileHash="b9e36903099d050892a977f5490a5a92dc43907b39331e291cec49270e47d56a" />
Include="sentry-cli-Linux-i686" FileHash="21a2f454006e48222ec7c92ea9be2bee19b2013ebcb78e83eb9d062f3ec87f60" />
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Linux')) And $(_OSArchitecture) == 'X64')"
Include="sentry-cli-Linux-x86_64" FileHash="f2d4eb5a5d338278b7c38d5fa16a33026602827c6fac5cdb7b35b909c91de001" />
Include="sentry-cli-Linux-x86_64" FileHash="7f949b842cc5c48e6fe291469f972df915c68db53d0ff0b51cf8d30dd90cd719" />
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Windows')) And $(_OSArchitecture) == 'X86')"
Include="sentry-cli-Windows-i686.exe" FileHash="1f874311502f39d2a0a5d192b785a66d5bb8fd0cbca75b992aff86acfad7a916" />
Include="sentry-cli-Windows-i686.exe" FileHash="3ccd585433a3dba3fb014b151ab59aae816de1445a7395e7aff8b831e0c2e11a" />
<SentryCLIDownload
Condition="'$(CI_PUBLISHING_BUILD)' == 'true' Or ($([MSBuild]::IsOSPlatform('Windows')) And $(_OSArchitecture) != 'X86')"
Include="sentry-cli-Windows-x86_64.exe" FileHash="8762fb82bc12e3a9642013ef91a495d459d533ff6d1a0112baaf776c7540aef1" />
Include="sentry-cli-Windows-x86_64.exe" FileHash="c06c4e22b8edc6d3c1e4cc11fd6cd515f980069b4c736b0ec04fd5cfc1689c3c" />
</ItemGroup>

<!-- Download the files -->
Expand Down
4 changes: 2 additions & 2 deletions src/Sentry/SentryOptions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -716,10 +716,10 @@ public IList<SubstringOrRegexPattern> FailedRequestTargets {
public Dictionary<string, string> DefaultTags => _defaultTags ??= new Dictionary<string, string>();

/// <summary>
/// Indicates whether tracing is enabled, via any combination of
/// Indicates whether the performance feature is enabled, via any combination of
/// <see cref="EnableTracing"/>, <see cref="TracesSampleRate"/>, or <see cref="TracesSampler"/>.
/// </summary>
internal bool IsTracingEnabled => EnableTracing switch
internal bool IsPerformanceMonitoringEnabled => EnableTracing switch
{
false => false,
null => TracesSampler is not null || TracesSampleRate is > 0.0,
Expand Down
1 change: 1 addition & 0 deletions src/Sentry/TransactionTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,7 @@ internal TransactionTracer(IHub hub, ITransactionContext context, TimeSpan? idle
Description = context.Description;
Status = context.Status;
IsSampled = context.IsSampled;
StartTimestamp = _stopwatch.StartDateTimeOffset;

if (context is TransactionContext transactionContext)
{
Expand Down
85 changes: 51 additions & 34 deletions test/Sentry.Tests/Protocol/TransactionTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,57 @@ public TransactionTests(ITestOutputHelper output)
_testOutputLogger = new TestOutputDiagnosticLogger(output);
}

[Fact]
public void NewTransactionTracer_ConstructingWithNameAndOperation_HasValidStartTime()
{
var actualTransaction = new TransactionTracer(DisabledHub.Instance, "test-name", "test-operation");

Assert.NotEqual(DateTimeOffset.MinValue, actualTransaction.StartTimestamp);
}

[Fact]
public void NewTransactionTracer_ConstructingWithContext_HasValidStartTime()
{
var context = new TransactionContext("test-name", "test-operation");

var actualTransaction = new TransactionTracer(DisabledHub.Instance, context);

Assert.NotEqual(DateTimeOffset.MinValue, actualTransaction.StartTimestamp);
}

[Fact]
public async Task NewTransactionTracer_IdleTimeoutProvided_AutomaticallyFinishes()
{
// Arrange
var client = Substitute.For<ISentryClient>();
var options = new SentryOptions
{
Dsn = ValidDsn,
Debug = true
};
var hub = new Hub(options, client);
var context = new TransactionContext(
SpanId.Create(),
SpanId.Create(),
SentryId.Create(),
"my name",
"my operation",
"description",
SpanStatus.Ok,
null,
true,
TransactionNameSource.Component
);

var transaction = new TransactionTracer(hub, context, TimeSpan.FromMilliseconds(2));

// Act
await Task.Delay(TimeSpan.FromSeconds(2));

// Assert
transaction.IsFinished.Should().BeTrue();
}

[Fact]
public void Redact_Redacts_Urls()
{
Expand Down Expand Up @@ -561,38 +612,4 @@ public void ISpan_GetTransaction_FromSpan()
// Assert
Assert.Same(transaction, result);
}

[Fact]
public async Task NewTransactionTracer_IdleTimeoutProvided_AutomaticallyFinishes()
{
// Arrange
var client = Substitute.For<ISentryClient>();
var options = new SentryOptions
{
Dsn = ValidDsn,
Debug = true
};
var hub = new Hub(options, client);
var context = new TransactionContext(
SpanId.Create(),
SpanId.Create(),
SentryId.Create(),
"my name",
"my operation",
"description",
SpanStatus.Ok,
null,
true,
TransactionNameSource.Component
);

var transaction = new TransactionTracer(hub, context, TimeSpan.FromMilliseconds(2));

// Act
await Task.Delay(TimeSpan.FromSeconds(2));

// Assert
transaction.IsFinished.Should().BeTrue();
}

}
40 changes: 20 additions & 20 deletions test/Sentry.Tests/SentryOptionsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,85 +52,85 @@ public void TracesSampler_Default_Null()
}

[Fact]
public void IsTracingEnabled_Default_False()
public void IsPerformanceMonitoringEnabled_Default_False()
{
var sut = new SentryOptions();
Assert.False(sut.IsTracingEnabled);
Assert.False(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_EnableTracing_True()
public void IsPerformanceMonitoringEnabled_EnableTracing_True()
{
var sut = new SentryOptions
{
EnableTracing = true
};

Assert.True(sut.IsTracingEnabled);
Assert.True(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_EnableTracing_False()
public void IsPerformanceMonitoringEnabled_EnableTracing_False()
{
var sut = new SentryOptions
{
EnableTracing = false
};

Assert.False(sut.IsTracingEnabled);
Assert.False(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_TracesSampleRate_Zero()
public void IsPerformanceMonitoringEnabled_TracesSampleRate_Zero()
{
var sut = new SentryOptions
{
TracesSampleRate = 0.0
};

Assert.False(sut.IsTracingEnabled);
Assert.False(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_TracesSampleRate_GreaterThanZero()
public void IsPerformanceMonitoringEnabled_TracesSampleRate_GreaterThanZero()
{
var sut = new SentryOptions
{
TracesSampleRate = double.Epsilon
};

Assert.True(sut.IsTracingEnabled);
Assert.True(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_TracesSampleRate_LessThanZero()
public void IsPerformanceMonitoringEnabled_TracesSampleRate_LessThanZero()
{
var sut = new SentryOptions();
Assert.Throws<ArgumentOutOfRangeException>(() =>
sut.TracesSampleRate = -double.Epsilon);
}

[Fact]
public void IsTracingEnabled_TracesSampleRate_GreaterThanOne()
public void IsPerformanceMonitoringEnabled_TracesSampleRate_GreaterThanOne()
{
var sut = new SentryOptions();
Assert.Throws<ArgumentOutOfRangeException>(() =>
sut.TracesSampleRate = 1.0000000000000002);
}

[Fact]
public void IsTracingEnabled_TracesSampler_Provided()
public void IsPerformanceMonitoringEnabled_TracesSampler_Provided()
{
var sut = new SentryOptions
{
TracesSampler = _ => null
};

Assert.True(sut.IsTracingEnabled);
Assert.True(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_EnableTracing_True_TracesSampleRate_Zero()
public void IsPerformanceMonitoringEnabled_EnableTracing_True_TracesSampleRate_Zero()
{
// Edge Case:
// Tracing enabled, but sample rate set to zero, and no sampler function, should be treated as disabled.
Expand All @@ -141,11 +141,11 @@ public void IsTracingEnabled_EnableTracing_True_TracesSampleRate_Zero()
TracesSampleRate = 0.0
};

Assert.False(sut.IsTracingEnabled);
Assert.False(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_EnableTracing_False_TracesSampleRate_One()
public void IsPerformanceMonitoringEnabled_EnableTracing_False_TracesSampleRate_One()
{
// Edge Case:
// Tracing disabled should be treated as disabled regardless of sample rate set.
Expand All @@ -156,11 +156,11 @@ public void IsTracingEnabled_EnableTracing_False_TracesSampleRate_One()
TracesSampleRate = 1.0
};

Assert.False(sut.IsTracingEnabled);
Assert.False(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
public void IsTracingEnabled_EnableTracing_False_TracesSampler_Provided()
public void IsPerformanceMonitoringEnabled_EnableTracing_False_TracesSampler_Provided()
{
// Edge Case:
// Tracing disabled should be treated as disabled regardless of sampler function set.
Expand All @@ -171,7 +171,7 @@ public void IsTracingEnabled_EnableTracing_False_TracesSampler_Provided()
TracesSampler = _ => null
};

Assert.False(sut.IsTracingEnabled);
Assert.False(sut.IsPerformanceMonitoringEnabled);
}

[Fact]
Expand Down

0 comments on commit f457e3a

Please sign in to comment.