Skip to content

Commit

Permalink
Merge branch 'main' into cs_context
Browse files Browse the repository at this point in the history
  • Loading branch information
chris-smith-zocdoc authored Nov 16, 2022
2 parents 0c156b3 + b3a921a commit 23b39f1
Show file tree
Hide file tree
Showing 23 changed files with 199 additions and 125 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

# IMPORTANT: This workflow MUST use the same 'name' as the non -md workflow.

name: Linux
name: Build

on:
pull_request:
Expand All @@ -19,7 +19,11 @@ jobs:

strategy:
matrix:
version: [netcoreapp3.1,net6.0]
os: [ windows-latest, ubuntu-latest ]
version: [ net462, netcoreapp3.1, net6.0 ]
exclude:
- os: ubuntu-latest
version: net462

steps:
- run: 'echo "No build required"'
15 changes: 10 additions & 5 deletions .github/workflows/windows-ci.yml → .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Windows
name: Build

on:
push:
Expand All @@ -12,13 +12,18 @@ on:

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


strategy:
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
matrix:
version: [net462,netcoreapp3.1,net6.0]
os: [ windows-latest, ubuntu-latest ]
version: [ net462, netcoreapp3.1, net6.0 ]
exclude:
- os: ubuntu-latest
version: net462

runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3

Expand All @@ -29,4 +34,4 @@ jobs:
run: dotnet build --configuration Release --no-restore

- name: Test ${{ matrix.version }}
run: dotnet test **\bin\**\${{ matrix.version }}\*Tests.dll --configuration Release --no-build --logger:"console;verbosity=detailed"
run: dotnet test **/bin/**/${{ matrix.version }}/*Tests.dll --configuration Release --no-build --logger:"console;verbosity=detailed"
32 changes: 0 additions & 32 deletions .github/workflows/linux-ci.yml

This file was deleted.

2 changes: 1 addition & 1 deletion .github/workflows/markdownlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:
- name: check out code
uses: actions/checkout@v3
uses: actions/checkout@v3.1.0

- name: install markdownlint-cli
run: sudo npm install -g markdownlint-cli
Expand Down
25 changes: 0 additions & 25 deletions .github/workflows/windows-ci-md.yml

This file was deleted.

6 changes: 2 additions & 4 deletions opentelemetry-dotnet-contrib.sln
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
ProjectSection(SolutionItems) = preProject
.github\workflows\assign-reviewers.yml = .github\workflows\assign-reviewers.yml
.github\workflows\codeql-analysis.yml = .github\workflows\codeql-analysis.yml
.github\workflows\ci-md.yml = .github\workflows\ci-md.yml
.github\workflows\ci.yml = .github\workflows\ci.yml
.github\workflows\dotnet-core-cov.yml = .github\workflows\dotnet-core-cov.yml
.github\workflows\dotnet-format-md.yml = .github\workflows\dotnet-format-md.yml
.github\workflows\dotnet-format.yml = .github\workflows\dotnet-format.yml
.github\workflows\integration-md.yml = .github\workflows\integration-md.yml
.github\workflows\integration.yml = .github\workflows\integration.yml
.github\workflows\linux-ci-md.yml = .github\workflows\linux-ci-md.yml
.github\workflows\linux-ci.yml = .github\workflows\linux-ci.yml
.github\workflows\markdownlint.yml = .github\workflows\markdownlint.yml
.github\workflows\package-Exporter.Geneva.yml = .github\workflows\package-Exporter.Geneva.yml
.github\workflows\package-Exporter.Instana.yml = .github\workflows\package-Exporter.Instana.yml
Expand Down Expand Up @@ -63,8 +63,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
.github\workflows\package-Instrumentation.Wcf.yml = .github\workflows\package-Instrumentation.Wcf.yml
.github\workflows\sanitycheck.yml = .github\workflows\sanitycheck.yml
.github\workflows\stale.yml = .github\workflows\stale.yml
.github\workflows\windows-ci-md.yml = .github\workflows\windows-ci-md.yml
.github\workflows\windows-ci.yml = .github\workflows\windows-ci.yml
EndProjectSection
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "build", "build", "{824BD1DE-3FA8-4FE0-823A-FD365EAC78AF}"
Expand Down
4 changes: 4 additions & 0 deletions src/OpenTelemetry.Contrib.Instrumentation.AWS/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

## 1.0.2

Released 2022-Nov-11

* Fixed issue when using version 3.7.100 of the AWS SDK for .NET triggering an
EndpointResolver not found exception.
([#726](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/726))
Expand Down
11 changes: 8 additions & 3 deletions src/OpenTelemetry.Extensions/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,23 @@

## Unreleased

## 1.0.0-beta.3

Released 2022-Nov-09

* Update OpenTelemetry to 1.4.0-beta.2 ([#680](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/680))

* Implemented auto flush activity processor
([#297](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/297))

* Removes .NET Framework 4.6.1. The minimum .NET Framework version
supported is .NET 4.6.2.

* Removes net5.0 target as .NET 5.0 is going out
* Removes net5.0 target as .NET 5.0 is going out
of support. The package keeps netstandard2.0 target, so it
can still be used with .NET5.0 apps.
([#617](https://github.com/open-telemetry/opentelemetry-dotnet/pull/617))

## 1.0.0-beta.3

* Going forward the NuGet package will be
[`OpenTelemetry.Extensions`](https://www.nuget.org/packages/OpenTelemetry.Extensions).
Older versions will remain at
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ public override void OnEnd(LogRecord data)
tags[nameof(data.EventId)] = data.EventId;
}

var activityEvent = new ActivityEvent("log", data.Timestamp, tags);

data.ForEachScope(ProcessScope, new State(tags, this));

if (data.StateValues != null)
Expand All @@ -84,6 +82,7 @@ public override void OnEnd(LogRecord data)
tags[nameof(data.FormattedMessage)] = data.FormattedMessage;
}

var activityEvent = new ActivityEvent("log", data.Timestamp, tags);
activity.AddEvent(activityEvent);

if (data.Exception != null)
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Extensions/OpenTelemetry.Extensions.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFrameworks>net462;netstandard2.0</TargetFrameworks>
<TargetFrameworks Condition="'$(Configuration)' == 'Debug'">$(TargetFrameworks);net6.0</TargetFrameworks> <!-- Added just to get proper nullable analysis in IDE -->
<Description>OpenTelemetry .NET SDK preview features and extensions</Description>
<MinVerTagPrefix>Preview-</MinVerTagPrefix>
<MinVerTagPrefix>Extensions-</MinVerTagPrefix>
<Nullable>enable</Nullable>
<EnableAnalysis>true</EnableAnalysis>
<EnablePublicApi>true</EnablePublicApi>
Expand All @@ -16,7 +16,7 @@
</ItemGroup>

<ItemGroup>
<PackageReference Include="OpenTelemetry" Version="1.1.0" />
<PackageReference Include="OpenTelemetry" Version="$(OpenTelemetryCoreLatestPrereleaseVersion)" />
</ItemGroup>

</Project>
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Released 2021-Oct-08
[Microsoft.AspNet.TelemetryCorrelation](https://www.nuget.org/packages/Microsoft.AspNet.TelemetryCorrelation/)
to listen for incoming http requests to the process. Please see the (Step 2:
Modify
Web.config)[https://github.com/open-telemetry/opentelemetry-dotnet/tree/main/src/OpenTelemetry.Instrumentation.AspNet#step-2-modify-webconfig]
Web.config)[https://github.com/open-telemetry/opentelemetry-dotnet-contrib/tree/main/src/OpenTelemetry.Instrumentation.AspNet#step-2-modify-webconfig]
README section for details on the new HttpModule definition required.
([#2222](https://github.com/open-telemetry/opentelemetry-dotnet/issues/2222))

Expand Down
12 changes: 6 additions & 6 deletions src/OpenTelemetry.Instrumentation.AspNet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ and
[traces](https://github.com/open-telemetry/opentelemetry-specification/tree/main/specification/trace/semantic_conventions).
These conventions are
[Experimental](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/document-status.md),
and hence, this package is a [pre-release](../../VERSIONING.md#pre-releases).
and hence, this package is a [pre-release](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/VERSIONING.md#pre-releases).
Until a [stable
version](https://github.com/open-telemetry/opentelemetry-specification/blob/main/specification/telemetry-stability.md)
is released, there can be breaking changes. You can track the progress from
Expand Down Expand Up @@ -57,8 +57,8 @@ following shows changes required to your `Web.config` when using IIS web server.
ASP.NET instrumentation must be enabled at application startup. This is
typically done in the `Global.asax.cs` as shown below. This example also sets up
the OpenTelemetry Jaeger exporter, which requires adding the package
[`OpenTelemetry.Exporter.Jaeger`](../OpenTelemetry.Exporter.Jaeger/README.md) to
the application.
[`OpenTelemetry.Exporter.Jaeger`](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.Jaeger/README.md)
to the application.

```csharp
using OpenTelemetry;
Expand Down Expand Up @@ -150,9 +150,9 @@ this.tracerProvider = Sdk.CreateTracerProviderBuilder()
.Build();
```

[Processor](../../docs/trace/extending-the-sdk/README.md#processor), is the
general extensibility point to add additional properties to any activity. The
`Enrich` option is specific to this instrumentation, and is provided to get
[Processor](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/docs/trace/extending-the-sdk/README.md#processor),
is the general extensibility point to add additional properties to any activity.
The `Enrich` option is specific to this instrumentation, and is provided to get
access to `HttpRequest` and `HttpResponse`.

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

## Unreleased

## 1.0.0-alpha.2

Released 2022-Nov-10

* Update OpenTelemetry.Api to 1.3.1.
* Change `EventCounter` prefix to `ec` and trim the event source name to keep
instrument name under 63 characters.
([#740](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/740))

## 1.0.0-alpha.1

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ internal sealed class EventCountersMetrics : EventListener
{
internal static readonly Meter MeterInstance = new(typeof(EventCountersMetrics).Assembly.GetName().Name, typeof(EventCountersMetrics).Assembly.GetName().Version.ToString());

private const string Prefix = "ec";
private const int MaxInstrumentNameLength = 63;

private readonly EventCountersInstrumentationOptions options;
private readonly List<EventSource> preInitEventSources = new();
private readonly ConcurrentDictionary<(string, string), Instrument> instruments = new();
Expand Down Expand Up @@ -120,6 +123,39 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData)
private static Dictionary<string, string> GetEnableEventsArguments(EventCountersInstrumentationOptions options) =>
new() { { "EventCounterIntervalSec", options.RefreshIntervalSecs.ToString() } };

/// <summary>
/// If the resulting instrument name is too long, it trims the event source name
/// to fit in as many characters as possible keeping the event name intact.
/// E.g. instrument for `Microsoft-AspNetCore-Server-Kestrel`, `tls-handshakes-per-second`
/// would be too long (64 chars), so it's shortened to `ec.Microsoft-AspNetCore-Server-Kestre.tls-handshakes-per-second`.
///
/// If there is no room for event source name, returns `ec.{event name}` and
/// if it's still too long, it will be validated and ignored later in the pipeline.
/// </summary>
private static string GetInstrumentName(string sourceName, string eventName)
{
int totalLength = Prefix.Length + 1 + sourceName.Length + 1 + eventName.Length;
if (totalLength <= MaxInstrumentNameLength)
{
return string.Concat(Prefix, ".", sourceName, ".", eventName);
}

var maxEventSourceLength = MaxInstrumentNameLength - Prefix.Length - 2 - eventName.Length;
if (maxEventSourceLength < 1)
{
// event name is too long, there is not enough space for sourceName.
// let ec.<eventName> flow to metrics SDK and it will suppress it if needed.
return string.Concat(Prefix, ".", eventName);
}

while (maxEventSourceLength > 0 && (sourceName[maxEventSourceLength - 1] == '.' || sourceName[maxEventSourceLength - 1] == '-'))
{
maxEventSourceLength--;
}

return string.Concat(Prefix, ".", sourceName.Substring(0, maxEventSourceLength), ".", eventName);
}

private void EnableEvents(EventSource eventSource)
{
this.EnableEvents(eventSource, EventLevel.Critical, EventKeywords.None, GetEnableEventsArguments(this.options));
Expand All @@ -132,10 +168,9 @@ private void UpdateInstrumentWithEvent(bool isGauge, string eventSourceName, str
ValueTuple<string, string> metricKey = new(eventSourceName, name);
_ = this.values.AddOrUpdate(metricKey, value, isGauge ? (_, _) => value : (_, existing) => existing + value);

var instrumentName = $"EventCounters.{eventSourceName}.{name}";

if (!this.instruments.ContainsKey(metricKey))
{
var instrumentName = GetInstrumentName(eventSourceName, name);
Instrument instrument = isGauge
? MeterInstance.CreateObservableGauge(instrumentName, () => this.values[metricKey])
: MeterInstance.CreateObservableCounter(instrumentName, () => this.values[metricKey]);
Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Instrumentation.MassTransit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ x.AddMassTransitInstrumentation(
}));
```

For full operation list please see: [OperationName](../OpenTelemetry.Instrumentation.MassTransit/Implementation/OperationName.cs).
For full operation list please see: [OperationName](OperationName.cs).

All operations are enabled by default.

Expand Down
2 changes: 1 addition & 1 deletion src/OpenTelemetry.Instrumentation.MySqlData/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ the `ConfigureServices` of your `Startup` class. Refer to documentation for
[OpenTelemetry.Instrumentation.AspNetCore](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.AspNetCore/README.md).

For an ASP.NET application, adding instrumentation is typically done in the
`Global.asax.cs`. Refer to documentation for [OpenTelemetry.Instrumentation.AspNet](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Instrumentation.AspNet/README.md).
`Global.asax.cs`. Refer to documentation for [OpenTelemetry.Instrumentation.AspNet](../OpenTelemetry.Instrumentation.AspNet/README.md).

Note, If you are using `Mysql.Data` 8.0.31 or later, please add
option `Logging=true` in your connection string to enable tracing.
Expand Down
10 changes: 10 additions & 0 deletions src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

## Unreleased

## 1.0.0-alpha.1

Released 2022-Nov-14

* Update the .NET API used to retrieve `process.memory.virtual` metric from
[Process.PrivateMemorySize64](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.privatememorysize64)
to
[Process.VirtualMemorySize64](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.virtualmemorysize64).
([#762](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/762))

* Update OTel API version to be `1.4.0-beta.2` and change process metrics type
from ObservableGauge to `ObservableUpDownCounter`. Updated instruments are:
"process.memory.usage", "process.memory.virtual" and "process.threads".
Expand Down
4 changes: 2 additions & 2 deletions src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,10 @@ public ProcessMetrics(ProcessInstrumentationOptions options)
"process.memory.virtual",
() =>
{
return Diagnostics.Process.GetCurrentProcess().PrivateMemorySize64;
return Diagnostics.Process.GetCurrentProcess().VirtualMemorySize64;
},
unit: "By",
description: "The amount of virtual memory allocated for this process that cannot be shared with other processes.");
description: "The amount of committed virtual memory for this process.");

this.MeterInstance.CreateObservableCounter(
"process.cpu.time",
Expand Down
Loading

0 comments on commit 23b39f1

Please sign in to comment.