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

- Removing obsolete netcoreapp2.0 runtime #2

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
46 changes: 46 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
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, 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
--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 2022
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