Skip to content

Commit

Permalink
Merge branch 'main' into Fix-issue-3149
Browse files Browse the repository at this point in the history
  • Loading branch information
xyq175com committed Jul 6, 2022
2 parents 237dab6 + 5722bba commit 523b7a7
Show file tree
Hide file tree
Showing 14 changed files with 133 additions and 51 deletions.
12 changes: 10 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,16 @@ and the new feature doesn't fit it.
### How to request for release of package

* Submit a PR with `CHANGELOG.md` file reflecting the version to be released
along with the date in the following format `[yyyy-MMM-dd`]`. For example:
"1.2.0-beta.2 [2022-May-15]".
along with the date in the following format `yyyy-MMM-dd`.

For example:

```text
## 1.2.0-beta.2
Released 2022-Jun-21
```

* Tag the maintainers of this repository
(@open-telemetry/dotnet-contrib-maintainers) who can release the package.

Expand Down
12 changes: 9 additions & 3 deletions src/OpenTelemetry.Contrib.Extensions.AWSXRay/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@
instance instead of recreating with ThreadLocal
([#380](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/380))

## 1.2.0 [2022-May-18]
## 1.2.0

Released 2022-May-18

* Enhancement - AWSEKSResourceDetector - Validate ClusterName/ContainerID
independently before adding it to the resource
Expand All @@ -15,13 +17,17 @@
"The SSL connection could not be established"
([#208](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/208))

## 1.1.0 [2021-Sept-20]
## 1.1.0

Released 2021-Sep-20

* Added AWS resource detectors ([#149](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/149))
* Updated OTel SDK package version to 1.1.0
([#100](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/100))

## 1.0.1 [2021-Feb-24]
## 1.0.1

Released 2021-Feb-24

This is the first release for the `OpenTelemetry.Contrib.Extensions.AWSXRay`
project. The project targets v1.0.1 of the [OpenTelemetry
Expand Down
4 changes: 3 additions & 1 deletion src/OpenTelemetry.Contrib.Instrumentation.AWS/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog - OpenTelemetry.Contrib.Instrumentation.AWS

## 1.0.1 [2021-Feb-24]
## 1.0.1

Released 2021-Feb-24

This is the first release for the `OpenTelemetry.Contrib.Instrumentation.AWS`
project. The release targets v1.0.1 of the
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,7 @@ internal static class AWSSemanticConventions

public const string AttributeHttpStatusCode = "http.status_code";
public const string AttributeHttpResponseContentLength = "http.response_content_length";

public const string AttributeValueDynamoDb = "dynamodb";
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
// <copyright file="AWSServiceHelper.cs" company="OpenTelemetry Authors">
// Copyright The OpenTelemetry Authors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
// </copyright>

using System;
using System.Collections.Generic;
using Amazon.Runtime;

namespace OpenTelemetry.Contrib.Instrumentation.AWS.Implementation
{
internal class AWSServiceHelper
{
internal static IReadOnlyDictionary<string, string> ServiceParameterMap = new Dictionary<string, string>()
{
{ DynamoDbService, "TableName" },
{ SQSService, "QueueUrl" },
};

internal static IReadOnlyDictionary<string, string> ParameterAttributeMap = new Dictionary<string, string>()
{
{ "TableName", AWSSemanticConventions.AttributeAWSDynamoTableName },
{ "QueueUrl", AWSSemanticConventions.AttributeAWSSQSQueueUrl },
};

private const string DynamoDbService = "DynamoDBv2";
private const string SQSService = "SQS";

internal static string GetAWSServiceName(IRequestContext requestContext)
=> Utils.RemoveAmazonPrefixFromServiceName(requestContext.Request.ServiceName);

internal static string GetAWSOperationName(IRequestContext requestContext)
{
string completeRequestName = requestContext.OriginalRequest.GetType().Name;
string suffix = "Request";
var operationName = Utils.RemoveSuffix(completeRequestName, suffix);
return operationName;
}

internal static bool IsDynamoDbService(string service)
=> DynamoDbService.Equals(service, StringComparison.OrdinalIgnoreCase);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ internal class AWSTracingPipelineHandler : PipelineHandler
carrier[name] = value;
};

private static readonly Dictionary<string, string> ServiceParameterMap = new Dictionary<string, string>()
{
{ "DynamoDBv2", "TableName" },
{ "SQS", "QueueUrl" },
};

private static readonly Dictionary<string, string> ParameterAttributeMap = new Dictionary<string, string>()
{
{ "TableName", AWSSemanticConventions.AttributeAWSDynamoTableName },
{ "QueueUrl", AWSSemanticConventions.AttributeAWSSQSQueueUrl },
};

private static readonly ActivitySource AWSSDKActivitySource = new ActivitySource(ActivitySourceName);

private readonly AWSClientInstrumentationOptions options;
Expand Down Expand Up @@ -117,8 +105,8 @@ private Activity ProcessBeginRequest(IExecutionContext executionContext)
Activity activity = null;

var requestContext = executionContext.RequestContext;
var service = this.GetAWSServiceName(requestContext);
var operation = this.GetAWSOperationName(requestContext);
var service = AWSServiceHelper.GetAWSServiceName(requestContext);
var operation = AWSServiceHelper.GetAWSOperationName(requestContext);

activity = AWSSDKActivitySource.StartActivity(service + "." + operation, ActivityKind.Client);

Expand Down Expand Up @@ -192,37 +180,26 @@ private void ProcessException(Activity activity, Exception ex)
}
}

private string GetAWSServiceName(IRequestContext requestContext)
{
string serviceName = string.Empty;
serviceName = Utils.RemoveAmazonPrefixFromServiceName(requestContext.Request.ServiceName);
return serviceName;
}

private string GetAWSOperationName(IRequestContext requestContext)
{
string operationName = string.Empty;
string completeRequestName = requestContext.OriginalRequest.GetType().Name;
string suffix = "Request";
operationName = Utils.RemoveSuffix(completeRequestName, suffix);
return operationName;
}

private void AddRequestSpecificInformation(Activity activity, IRequestContext requestContext, string service)
{
AmazonWebServiceRequest request = requestContext.OriginalRequest;

if (ServiceParameterMap.TryGetValue(service, out string parameter))
if (AWSServiceHelper.ServiceParameterMap.TryGetValue(service, out string parameter))
{
AmazonWebServiceRequest request = requestContext.OriginalRequest;

var property = request.GetType().GetProperty(parameter);
if (property != null)
{
if (ParameterAttributeMap.TryGetValue(parameter, out string attribute))
if (AWSServiceHelper.ParameterAttributeMap.TryGetValue(parameter, out string attribute))
{
activity.SetTag(attribute, property.GetValue(request));
}
}
}

if (AWSServiceHelper.IsDynamoDbService(service))
{
activity.SetTag(SemanticConventions.AttributeDbSystem, AWSSemanticConventions.AttributeValueDynamoDb);
}
}

private void AddStatusCodeToActivity(Activity activity, int status_code)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net452;netstandard2.0</TargetFrameworks>
Expand All @@ -13,5 +13,6 @@

<ItemGroup>
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Internal\Guard.cs" Link="Includes\Guard.cs" />
<Compile Include="$(RepoRoot)\src\OpenTelemetry.Contrib.Shared\Api\SemanticConventions.cs" Link="Includes\SemanticConventions.cs"/>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog - OpenTelemetry.Contrib.Instrumentation.AWSLambda

## 1.1.0-beta1 [2021-May-26]
## 1.1.0-beta1

Released 2021-May-26

This is the first release for the `OpenTelemetry.Contrib.Instrumentation.AWSLambda`
project. The project targets v1.1.0-beta1 of the [OpenTelemetry
Expand Down
20 changes: 15 additions & 5 deletions src/OpenTelemetry.Exporter.Geneva/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,16 @@ by throwing any exception caught by `UnixDomainSocketDataTransport.Send` so that
`ExportResult.Failure`.
[444](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/444)

## 1.3.0-beta.2 [2022-Jun-03]
## 1.3.0-beta.2

Released 2022-Jun-03

* Add support for exporting `ILogger` scopes.
[390](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/390)

## 1.3.0-beta.1 [2022-May-27]
## 1.3.0-beta.1

Released 2022-May-27

* Enable PassThru TableNameMappings using the logger category name.
[345](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/345)
Expand All @@ -44,12 +48,16 @@ by throwing any exception caught by `UnixDomainSocketDataTransport.Send` so that
`LogRecord.Exception.GetType().FullName`.
[375](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/375)

## 1.2.6 [2022-Apr-21]
## 1.2.6

Released 2022-Apr-21

* Set GenevaMetricExporter temporality preference back to Delta.
[323](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/323)

## 1.2.5 [2022-Apr-20] Broken
## 1.2.5 Broken

Released 2022-Apr-20

Note: This release was broken due to the GenevaMetricExporter using a
TemporalityPreference of Cumulative instead of Delta, it has been unlisted from
Expand All @@ -60,7 +68,9 @@ is the PR that introduced this bug to GenevaMetricExporterExtensions.cs
* Update OTel SDK version to `1.2.0`.
[319](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/319)

## 1.2.4 [2022-Apr-20] Broken
## 1.2.4 Broken

Released 2022-Apr-20

This is the first release of the `OpenTelemetry.Exporter.Geneva` project. Note:
This release was broken due to using OpenTelemetry 1.2.0-rc5. Therefore, it has
Expand Down
12 changes: 9 additions & 3 deletions src/OpenTelemetry.Exporter.Instana/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,23 @@

## Unreleased

## 1.0.2 [2022-Jun-02]
## 1.0.2

Released 2022-Jun-02

* Application is chrashing if environment variables are not defined
[385](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/385)

## 1.0.1 [2022-May-25]
## 1.0.1

Released 2022-May-25

* Instana span duration was not calculated correctly
[376](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/376)

## 1.0.0 [2022-May-24]
## 1.0.0

Released 2022-May-24

* This is the first release of the `OpenTelemetry.Exporter.Instana`
project.
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Instrumentation.MySqlData/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.0.0-beta.3

Released 2022-Jun-29

* Fix incomplete db.statement when the length>300
[(#424)](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/424)

Expand Down
7 changes: 7 additions & 0 deletions src/OpenTelemetry.Instrumentation.Runtime/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@

## Unreleased

## 1.0.0-rc.1

Released 2022-Jun-29

Major refactor of the runtime instrumentation. Renamed API signature and metrics.
Removed the options to turn off certain metrics.

## 1.0.0-beta.1

Major redesign of the runtime instrumentation. Renamed metrics to be more user-friendly
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Changelog

## Unreleased
## 1.0.0-rc9.6

Released 2022-Jun-29

* Added the EnrichActivityWithTimingEvents option to
StackExchangeRedisCallsInstrumentationOptions to be able to disable adding
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ private void ValidateDynamoActivityTags(Activity ddb_activity)
Assert.Equal("Scan", Utils.GetTagValue(ddb_activity, "aws.operation"));
Assert.Equal("us-east-1", Utils.GetTagValue(ddb_activity, "aws.region"));
Assert.Equal("SampleProduct", Utils.GetTagValue(ddb_activity, "aws.table_name"));
Assert.Equal("dynamodb", Utils.GetTagValue(ddb_activity, "db.system"));
}

private void ValidateSqsActivityTags(Activity sqs_activity)
Expand Down

0 comments on commit 523b7a7

Please sign in to comment.