Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

3.x merge from master #236

Merged
merged 42 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
42 commits
Select commit Hold shift + click to select a range
34e411a
Create stale.yml (#136)
srprash Jun 9, 2020
63bb73c
Release commit for v2.9.0 (#137)
srprash Jun 10, 2020
ac6fe04
Added 2 seconds timeout for EC2 metadata requests (#138)
srprash Jun 23, 2020
1e05a2b
Update NOTICE so it only has third party licenses and no proprietary …
Jul 16, 2020
0c1b817
Fixing link to EFCore usage section (#143)
srprash Aug 14, 2020
3ae4cdb
Added EF Core installation instruction step (#145)
lupengamzn Aug 25, 2020
8461c35
Fixing race condition for initializing and running timer in RulePolle…
srprash Oct 13, 2020
4a7ed00
Bump AWSSDK.Core dependency version (#155)
lupengamzn Oct 14, 2020
a085520
Applied HttpClient to get sampling info (#159)
lupengamzn Nov 6, 2020
a983338
Adding limitation for EFCore with multiple DbCommandInterceptor (#164)
srprash Dec 3, 2020
8a9c600
Updated xraycontext to use a concurrent dictionary (#157)
sdolier Dec 14, 2020
412185f
Enable tracing S3 id pairs and fix SNS naming issue. (#168)
lupengamzn Dec 29, 2020
ff3648d
Fixed appvoyer building configuration issue. (#173)
lupengamzn Jan 15, 2021
2a1891a
Add tracing support for EntityFramework 6 (.NET Framework) (#171)
lupengamzn Jan 27, 2021
280b6dc
Added release workflow (#179)
lupengamzn Feb 11, 2021
34134f0
Switching out AppVeyor for GH workflow (#181)
srprash Feb 18, 2021
c114331
Revert "Switching out AppVeyor for GH workflow (#181)" (#185)
srprash Feb 23, 2021
57e976a
Added public key token (#186)
lupengamzn Mar 2, 2021
652f8f7
Release commit for v2.10.0 (#187)
lupengamzn Mar 2, 2021
d2b6412
Updated API Doc (#188)
lupengamzn Mar 3, 2021
551cdaa
Add smoke test of distribution channel (#189)
lupengamzn Mar 30, 2021
437b81c
Publish metric on distribution availability (#190)
bhautikpip Apr 2, 2021
c32a39d
Run test on ubuntu (#191)
bhautikpip Apr 2, 2021
42de800
Bump System.Net.Http from 4.3.3 to 4.3.4 in /sdk/src/Core (#193)
dependabot[bot] Apr 21, 2021
3b0cb91
Release commit for v2.10.1 (#194)
srprash Apr 21, 2021
0506c3c
Update continuous-monitoring.yml
willarmiros May 18, 2021
751c0c8
Merge pull request #199 from aws/willarmiros-patch-1
willarmiros May 18, 2021
5be713a
Increase continuous monitoring to 10 minutes
willarmiros May 18, 2021
abe67dc
Merge pull request #200 from aws/willarmiros-patch-2
willarmiros May 19, 2021
e87cf50
Add netcoreapp3.1 target framework
martincostello Oct 14, 2021
acf661f
Merge pull request #215 from martincostello/AspNet-Core-FrameworkRefe…
willarmiros Nov 9, 2021
9b4015d
Create CODEOWNERS
willarmiros Nov 10, 2021
2ecb5a9
Merge pull request #218 from aws/willarmiros-patch-2
willarmiros Nov 10, 2021
97e7a8a
Update appveyor.yml (#226)
lupengamzn Feb 10, 2022
193d70d
Update .netappcore version for smoke tests (#228)
bhautikpip Feb 21, 2022
d124bfd
Use GitHub workflow for CI on PRs and master builds (#231)
srprash Mar 7, 2022
b190352
Update continuous-monitoring.yml
jon-armen Mar 8, 2022
0f57392
Add Source Link support for enhanced debugging experience (#229)
jon-armen Mar 8, 2022
2034955
Finding the same exception in different subsegments should reuse the …
jon-armen Mar 17, 2022
975f356
Removed blocking call which was producing deadlocks from EC2Plugin. (…
samunro Mar 17, 2022
ad20483
Merge branch 'aws:master' into master
jon-armen Mar 17, 2022
2d9c99a
Adding 3.x for continous build
jon-armen Mar 17, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Number of days of inactivity before an issue becomes stale
daysUntilStale: 30
# Number of days of inactivity before a stale issue is closed
daysUntilClose: 7
# Limit to only `issues` or `pulls`
only: issues
# Issues with these labels will never be considered stale
exemptLabels:
- pinned
- bug
- enhancement
- feature-request
- help wanted
- work-in-progress
- pending release
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
markComment: >
This issue has been automatically marked as stale because it has not had
recent activity. It will be closed if no further activity occurs in next 7 days. Thank you
for your contributions.
# Comment to post when closing a stale issue. Set to `false` to disable
closeComment: false
48 changes: 48 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: Continuous Build

on:
push:
branches:
- master
- 3.x
pull_request:
branches:
- master
- 3.x

jobs:
build-test:
runs-on: windows-latest

env:
DOTNET_MULTILEVEL_LOOKUP: 1

strategy:
fail-fast: false
matrix:
version: [net452, netcoreapp2.0, netcoreapp3.1]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '2.0.x'

- uses: actions/setup-dotnet@v1
with:
dotnet-version: '3.1.x'

- name: Install dependencies
run: dotnet restore sdk/AWSXRayRecorder.sln

- name: Build solution
run: dotnet build sdk/AWSXRayRecorder.sln --configuration Release --no-restore

- name: Run tests
run: >-
dotnet test sdk/test/UnitTests/bin/Release/${{matrix.version}}/AWSXRayRecorder.UnitTests.dll
--configuration Release
--no-build
--logger "console;verbosity=detailed"
45 changes: 45 additions & 0 deletions .github/workflows/continuous-monitoring.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Continuous monitoring of distribution channels

on:
workflow_dispatch:

jobs:
smoke-tests:
name: Run smoke tests
runs-on: ${{ matrix.os }}

strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
version: [netcoreapp3.1]

steps:
- name: Checkout repository
uses: actions/checkout@v2

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-1

- name: Install dependencies
run: dotnet restore sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj

- name: Build tests
run: dotnet build sdk/test/SmokeTests/AWSXRayRecorder.SmokeTests.csproj --configuration Release --no-restore

- name: Run tests
id: distribution-availability
run: dotnet test sdk/test/SmokeTests/bin/Release/${{matrix.version}}/AWSXRayRecorder.SmokeTests.dll

- name: Publish metric on X-Ray Dotnet SDK distribution availability
if: ${{ always() }}
run: |
if [[ "${{ steps.distribution-availability.outcome }}" == "failure" ]]; then
aws cloudwatch put-metric-data --metric-name XRayDotnetSDKDistributionUnavailability --dimensions failure=rate --namespace MonitorSDK --value 1 --timestamp $(date +%s)
else
aws cloudwatch put-metric-data --metric-name XRayDotnetSDKDistributionUnavailability --dimensions failure=rate --namespace MonitorSDK --value 0 --timestamp $(date +%s)
fi
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Release X-Ray .NET SDK

on:
workflow_dispatch:
inputs:
version:
description: The version to tag the release with, e.g., 1.2.0, 1.3.0
required: true

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout master branch
uses: actions/checkout@v2

- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: 'V${{ github.event.inputs.version }}'
release_name: 'Release ${{ github.event.inputs.version }}'
body: 'Please refer [change-log](https://github.com/aws/aws-xray-sdk-dotnet/blob/master/CHANGELOG.md) for more details'
draft: true
prerelease: false
86 changes: 86 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,92 @@
# Change Log
All notable changes to this project will be documented in this file.

## 2.10.1 (2021-04-21)
### AWSXRayRecorder.Core (2.10.1)
#### Fixed
- Bump System.Net.Http from 4.3.3 to 4.3.4 in /sdk/src/Core [PR#193](https://github.com/aws/aws-xray-sdk-dotnet/pull/193)

### AWSXRayRecorder.Handlers.AwsSdk (2.8.3)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.EntityFramework (1.1.1)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.AspNet (2.7.3)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.AspNetCore (2.7.3)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.SqlServer (2.7.3)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.System.Net (2.7.3)
- Bumped version to address AWSXRayRecorder.Core package change

## 2.10.0 (2021-03-02)
### AWSXRayRecorder.Core (2.10.0)
#### Fixed
- Fixed race condition where the rule poller may start immediately before initializing the timer [PR#154](https://github.com/aws/aws-xray-sdk-dotnet/pull/154)
- Updated xraycontext to use a concurrent dictionary [PR#157](https://github.com/aws/aws-xray-sdk-dotnet/pull/157)

#### Improved
- Added timeout for EC2 metadata requests [PR#138](https://github.com/aws/aws-xray-sdk-dotnet/pull/138)
- Applied HttpClient to get sampling info [PR#159](https://github.com/aws/aws-xray-sdk-dotnet/pull/159)

### AWSXRayRecorder.Handlers.AwsSdk (2.8.2)
#### Fixed
- Fixed tracing S3 id pairs and SNS naming issue [#168](https://github.com/aws/aws-xray-sdk-dotnet/pull/168)

### AWSXRayRecorder.Handlers.EntityFramework (1.1.0)
#### New Feature
- Added tracing support for EntityFramework 6 (.NET Framework) [PR#171](https://github.com/aws/aws-xray-sdk-dotnet/pull/171)

### AWSXRayRecorder.Handlers.AspNet (2.7.2)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.AspNetCore (2.7.2)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.SqlServer (2.7.2)
- Bumped version to address AWSXRayRecorder.Core package change

### AWSXRayRecorder.Handlers.System.Net (2.7.2)
- Bumped version to address AWSXRayRecorder.Core package change

## 2.9.0 (2020-06-09)
### AWSXRayRecorder.Core (2.9.0)
#### Fixed
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

#### Improved
- Added IMDSv2 support [PR#134](https://github.com/aws/aws-xray-sdk-dotnet/pull/134)

### AWSXRayRecorder.Handlers.AwsSdk (2.8.1)
#### Fixed
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

### AWSXRayRecorder.Handlers.EntityFramework (1.0.1)
#### Fixed
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

### AWSXRayRecorder.Handlers.AspNet (2.7.1)
#### Fixed
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

### AWSXRayRecorder.Handlers.AspNetCore (2.7.1)
#### Fixed
- Fixed typo in AWSXRayMiddlewareExtensions.cs. From Applicaion to Application [PR#131](https://github.com/aws/aws-xray-sdk-dotnet/pull/131)
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

### AWSXRayRecorder.Handlers.SqlServer (2.7.1)
#### Fixed
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

### AWSXRayRecorder.Handlers.System.Net (2.7.1)
#### Fixed
- Added .gitattributes file and normalized line endings [PR#132](https://github.com/aws/aws-xray-sdk-dotnet/pull/132)

## 2.8.0 (2020-04-17)
### AWSXRayRecorder.Core (2.8.0)
#### Fixed
Expand Down
11 changes: 11 additions & 0 deletions CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#####################################################
#
# List of approvers for this repository
#
#####################################################
#
# Learn about CODEOWNERS file format:
# https://help.github.com/en/articles/about-code-owners
#

* @aws/aws-x-ray
5 changes: 1 addition & 4 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
AWS X-Ray Recorder SDK for .NET
Copyright 2016 Amazon.com, Inc. or its affiliates. All Rights Reserved.

**********************
THIRD PARTY COMPONENTS
**********************
Expand Down Expand Up @@ -52,4 +49,4 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.

[This is the BSD license, see
http://opensource.org/licenses/BSD-3-Clause]
http://opensource.org/licenses/BSD-3-Clause]
68 changes: 64 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ Following API reference documentation provides guidance for using the SDK and mo
4. [Trace AWS SDK request](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#trace-aws-sdk-request-net-and-net-core--nuget)
5. [Trace out-going HTTP requests](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#trace-out-going-http-requests-net-and-net-core--nuget)
6. [Trace Query to SQL Server](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#trace-query-to-sql-server-net-and-net-core--nuget)
7. [Trace SQL Query through Entity Framework Core 3.0 and above](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#trace-sql-query-through-entity-framework-core-30-and-above-net-core)
7. [Trace SQL Query through Entity Framework](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#trace-sql-query-through-entity-framework-net-and-net-core--nuget)
8. [Multithreaded Execution](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#multithreaded-execution-net-and-net-core--nuget)
9. [Trace custom methods ](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#trace-custom-methods-net-and-net-core)
10. [Creating custom Segment/Subsegment](https://github.com/aws/aws-xray-sdk-dotnet/tree/master#creating-custom-segmentsubsegment-net-and-net-core)
Expand Down Expand Up @@ -384,17 +384,22 @@ using (var command = new TraceableSqlCommand("SELECT * FROM products", connectio
2. Parameterized values will appear in their tokenized form and will not be expanded.
3. The value of `collectSqlQueries` in the `TraceableSqlCommand` instance overrides the value set in the global configuration using the `CollectSqlQueries` property.

### Trace SQL Query through Entity Framework Core 3.0 and above (.NET Core) : [Nuget](https://www.nuget.org/packages/AWSXRayRecorder.Handlers.EntityFramework/)
### Trace SQL Query through Entity Framework (.NET and .NET Core) : [Nuget](https://www.nuget.org/packages/AWSXRayRecorder.Handlers.EntityFramework/)

#### Setup

##### .NET Core

AWS XRay SDK for .NET Core provides interceptor for tracing SQL query through Entity Framework Core (>=3.0).

For how to start with Entity Framework Core in an ASP.NET Core web app, please take reference to [Link](https://docs.microsoft.com/en-us/aspnet/core/data/ef-mvc/?view=aspnetcore-3.1)

*NOTE:*

* You need to install `AWSXRayRecorder.Handlers.EntityFramework` nuget package. This package adds extension methods to the `DbContextOptionsBuilder` to make it easy to register AWS X-Ray interceptor.
* Not all database provider support Entity Framework Core 3.0 and above, please make sure that you are using the [Nuget package](https://docs.microsoft.com/en-us/ef/core/providers/?tabs=dotnet-core-cli) with a compatible version (EF Core >= 3.0).

#### Setup
*Known Limitation (as of 12-03-2020):* If you're using another `DbCommandInterceptor` implementation along with the `AddXRayInterceptor` in the `DbContext`, it may not work as expected and you may see a "EntityNotAvailableException" from the XRay EFCore interceptor. This is due to [`AsyncLocal`](https://docs.microsoft.com/en-us/dotnet/api/system.threading.asynclocal-1?view=netcore-2.0) not being able to maintain context across the `ReaderExecutingAsync` and `ReaderExecutedAsync` methods. Ref [here](https://github.com/dotnet/efcore/issues/22766) for more details on the issue.

In order to trace SQL query, you can register your `DbContext` with `AddXRayInterceptor()` accordingly in the `ConfigureServices` method in `startup.cs` file.

Expand Down Expand Up @@ -423,10 +428,45 @@ public class your_DbContext : DbContext

The connection string can be either hard coded or configured from `appsettings.json` file.

##### .NET

AWS XRay SDK for .NET provides interceptor for tracing SQL query through Entity Framework 6 (>= 6.2.0).

For how to start with Entity Framework 6 in an ASP.NET web app, please take reference to [link](https://docs.microsoft.com/en-us/aspnet/mvc/overview/getting-started/getting-started-with-ef-using-mvc/creating-an-entity-framework-data-model-for-an-asp-net-mvc-application).

For instrumentation, you will need to install `AWSXRayRecorder.Handlers.EntityFramework` nuget package and call `AWSXRayEntityFramework6.AddXRayInterceptor()` in your code. Make sure to call it **only once** to avoid duplicate tracing.

For instance, you can call `AddXRayInterceptor()` in the `Application_Start` method of **Global.asax** file.

```
using Amazon.XRay.Recorder.Handlers.EntityFramework;

protected void Application_Start()
{
AWSXRayEntityFramework6.AddXRayInterceptor();
}
```

Or you can call it in the `DbConfiguration` class if there is one in your application to configure execution policy.

```
using Amazon.XRay.Recorder.Handlers.EntityFramework;

public class YourDbConfiguration : DbConfiguration
{
public YourDbConfiguration()
{
AWSXRayEntityFramework6.AddXRayInterceptor();
}
}
```

#### Capture SQL Query text in the traced SQL calls to SQL Server

You can also opt in to capture the `DbCommand.CommandText` as part of the subsegment created for your SQL query. The collected `DbCommand.CommandText` will appear as `sanitized_query` in the subsegment JSON. By default, this feature is disabled due to security reasons.

##### .NET Core

If you want to enable this feature, it can be done in two ways. First, by setting the `CollectSqlQueries` to **true** in the `appsettings.json` file as follows:

```json
Expand All @@ -437,7 +477,7 @@ If you want to enable this feature, it can be done in two ways. First, by settin
}
```

Secondly, you can set the `collectSqlQueries` parameter in the `AddXRayInterceptor()` as **true** to collect the SQL query text. If you set this parameter as **false**, it will disable the `collectSqlQueries` feature for this `AddXRayInterceptor()`.
Secondly, you can set the `collectSqlQueries` parameter in the `AddXRayInterceptor()` as **true** to collect the SQL query text. If you set this parameter as **false**, it will disable the `collectSqlQueries` feature for this `AddXRayInterceptor()`. Opting in `AddXRayInterceptor()` has the highest execution priority, which will override the configuration item in `appsettings.json` mentioned above.

```csharp
using Microsoft.EntityFrameworkCore;
Expand All @@ -460,6 +500,26 @@ public class your_DbContext : DbContext
}
```

##### .NET

You can enable tracing SQL query text for EF 6 interceptor in the `Web.config` file.

```xml
<configuration>
<appSettings>
<add key="CollectSqlQueries" value="true"/>
</appSettings>
</configuration>
```

You can also pass **true** to `AddXRayInterceptor()` to collect SQL query text, otherwise pass **false** to disable. Opting in `AddXRayInterceptor()` has the highest execution priority, which will override the configuration item in `Web.config` mentioned above.

```
using Amazon.XRay.Recorder.Handlers.EntityFramework;

AWSXRayEntityFramework6.AddXRayInterceptor(true);
```

### Multithreaded Execution (.NET and .NET Core) : [Nuget](https://www.nuget.org/packages/AWSXRayRecorder.Core/)

In multithreaded execution, X-Ray context from current to its child thread is automatically set.
Expand Down
4 changes: 2 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
version: '1.0.{build}'
image: Visual Studio 2017
image: Visual Studio 2019
init:
# Good practise, because Windows line endings are different from Unix/Linux ones
- cmd: git config --global core.autocrlf true
Expand All @@ -9,7 +9,7 @@ before_build:
build_script:
# output will be in ./src/bin/debug/netcoreapp1.1/publish
- cmd: dotnet restore sdk/AWSXRayRecorder.sln
- cmd: dotnet build sdk/AWSXRayRecorder.sln /p:SignAssembly=false
- cmd: dotnet build sdk/AWSXRayRecorder.sln
clone_depth: 1
test_script:
- cmd : dotnet test sdk/test/UnitTests
Expand Down
Loading