diff --git a/.github/workflows/linux-ci-md.yml b/.github/workflows/ci-md.yml
similarity index 78%
rename from .github/workflows/linux-ci-md.yml
rename to .github/workflows/ci-md.yml
index cec69098ec..345e969cb3 100644
--- a/.github/workflows/linux-ci-md.yml
+++ b/.github/workflows/ci-md.yml
@@ -5,7 +5,7 @@
# IMPORTANT: This workflow MUST use the same 'name' as the non -md workflow.
-name: Linux
+name: Build
on:
pull_request:
@@ -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"'
diff --git a/.github/workflows/windows-ci.yml b/.github/workflows/ci.yml
similarity index 56%
rename from .github/workflows/windows-ci.yml
rename to .github/workflows/ci.yml
index 541d0b6414..8c6058fa3d 100644
--- a/.github/workflows/windows-ci.yml
+++ b/.github/workflows/ci.yml
@@ -1,4 +1,4 @@
-name: Windows
+name: Build
on:
push:
@@ -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
@@ -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"
diff --git a/.github/workflows/linux-ci.yml b/.github/workflows/linux-ci.yml
deleted file mode 100644
index 4bf4d64b68..0000000000
--- a/.github/workflows/linux-ci.yml
+++ /dev/null
@@ -1,32 +0,0 @@
-name: Linux
-
-on:
- push:
- branches: [ main ]
- paths-ignore:
- - '**.md'
- pull_request:
- branches: [ main ]
- paths-ignore:
- - '**.md'
-
-jobs:
- build-test:
- runs-on: ubuntu-latest
-
- strategy:
- fail-fast: false # ensures the entire test matrix is run, even if one permutation fails
- matrix:
- version: [netcoreapp3.1,net6.0]
-
- steps:
- - uses: actions/checkout@v3
-
- - name: Install dependencies
- run: dotnet restore
-
- - name: Build
- 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"
diff --git a/.github/workflows/markdownlint.yml b/.github/workflows/markdownlint.yml
index 97f85f9e2b..fec61cedeb 100644
--- a/.github/workflows/markdownlint.yml
+++ b/.github/workflows/markdownlint.yml
@@ -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
diff --git a/.github/workflows/windows-ci-md.yml b/.github/workflows/windows-ci-md.yml
deleted file mode 100644
index 2e2bfd561a..0000000000
--- a/.github/workflows/windows-ci-md.yml
+++ /dev/null
@@ -1,25 +0,0 @@
-# Syntax: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
-# See also: https://docs.github.com/en/repositories/configuring-branches-and-merges-in-your-repository/defining-the-mergeability-of-pull-requests/troubleshooting-required-status-checks#handling-skipped-but-required-checks
-
-# Description: This workflow exists to unblock documentation-only PRs.
-
-# IMPORTANT: This workflow MUST use the same 'name' as the non -md workflow.
-
-name: Windows
-
-on:
- pull_request:
- branches: [ main ]
- paths:
- - '**.md'
-
-jobs:
- build-test:
- runs-on: ubuntu-latest
-
- strategy:
- matrix:
- version: [net462,netcoreapp3.1,net6.0]
-
- steps:
- - run: 'echo "No build required"'
diff --git a/opentelemetry-dotnet-contrib.sln b/opentelemetry-dotnet-contrib.sln
index d0925d4c72..22903a6b99 100644
--- a/opentelemetry-dotnet-contrib.sln
+++ b/opentelemetry-dotnet-contrib.sln
@@ -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
@@ -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}"
diff --git a/src/OpenTelemetry.Contrib.Instrumentation.AWS/CHANGELOG.md b/src/OpenTelemetry.Contrib.Instrumentation.AWS/CHANGELOG.md
index 1ef8260da8..3962068ec6 100644
--- a/src/OpenTelemetry.Contrib.Instrumentation.AWS/CHANGELOG.md
+++ b/src/OpenTelemetry.Contrib.Instrumentation.AWS/CHANGELOG.md
@@ -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))
diff --git a/src/OpenTelemetry.Extensions/CHANGELOG.md b/src/OpenTelemetry.Extensions/CHANGELOG.md
index b71c68bdca..6ef75c6144 100644
--- a/src/OpenTelemetry.Extensions/CHANGELOG.md
+++ b/src/OpenTelemetry.Extensions/CHANGELOG.md
@@ -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
diff --git a/src/OpenTelemetry.Extensions/Internal/ActivityEventAttachingLogProcessor.cs b/src/OpenTelemetry.Extensions/Internal/ActivityEventAttachingLogProcessor.cs
index 618c0749d1..ffaf8a75cb 100644
--- a/src/OpenTelemetry.Extensions/Internal/ActivityEventAttachingLogProcessor.cs
+++ b/src/OpenTelemetry.Extensions/Internal/ActivityEventAttachingLogProcessor.cs
@@ -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)
@@ -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)
diff --git a/src/OpenTelemetry.Extensions/OpenTelemetry.Extensions.csproj b/src/OpenTelemetry.Extensions/OpenTelemetry.Extensions.csproj
index 2595e97bb1..69f9513030 100644
--- a/src/OpenTelemetry.Extensions/OpenTelemetry.Extensions.csproj
+++ b/src/OpenTelemetry.Extensions/OpenTelemetry.Extensions.csproj
@@ -4,7 +4,7 @@
net462;netstandard2.0
$(TargetFrameworks);net6.0
OpenTelemetry .NET SDK preview features and extensions
- Preview-
+ Extensions-
enable
true
true
@@ -16,7 +16,7 @@
-
+
diff --git a/src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md
index ca186294be..d859c59e1b 100644
--- a/src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md
@@ -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))
diff --git a/src/OpenTelemetry.Instrumentation.AspNet/README.md b/src/OpenTelemetry.Instrumentation.AspNet/README.md
index 3a2ed2c1b7..aa73d15b14 100644
--- a/src/OpenTelemetry.Instrumentation.AspNet/README.md
+++ b/src/OpenTelemetry.Instrumentation.AspNet/README.md
@@ -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
@@ -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;
@@ -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
diff --git a/src/OpenTelemetry.Instrumentation.EventCounters/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.EventCounters/CHANGELOG.md
index f3f36b2d94..5a6e7c8486 100644
--- a/src/OpenTelemetry.Instrumentation.EventCounters/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.EventCounters/CHANGELOG.md
@@ -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
diff --git a/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs b/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
index c236463144..fe8f89dacc 100644
--- a/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
+++ b/src/OpenTelemetry.Instrumentation.EventCounters/EventCountersMetrics.cs
@@ -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 preInitEventSources = new();
private readonly ConcurrentDictionary<(string, string), Instrument> instruments = new();
@@ -120,6 +123,39 @@ protected override void OnEventWritten(EventWrittenEventArgs eventData)
private static Dictionary GetEnableEventsArguments(EventCountersInstrumentationOptions options) =>
new() { { "EventCounterIntervalSec", options.RefreshIntervalSecs.ToString() } };
+ ///
+ /// 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.
+ ///
+ 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. 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));
@@ -132,10 +168,9 @@ private void UpdateInstrumentWithEvent(bool isGauge, string eventSourceName, str
ValueTuple 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]);
diff --git a/src/OpenTelemetry.Instrumentation.MassTransit/README.md b/src/OpenTelemetry.Instrumentation.MassTransit/README.md
index f6067618dc..cacb56f8a1 100644
--- a/src/OpenTelemetry.Instrumentation.MassTransit/README.md
+++ b/src/OpenTelemetry.Instrumentation.MassTransit/README.md
@@ -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.
diff --git a/src/OpenTelemetry.Instrumentation.MySqlData/README.md b/src/OpenTelemetry.Instrumentation.MySqlData/README.md
index ea6cb7deee..1aded70cb7 100644
--- a/src/OpenTelemetry.Instrumentation.MySqlData/README.md
+++ b/src/OpenTelemetry.Instrumentation.MySqlData/README.md
@@ -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.
diff --git a/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md b/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md
index 2daf411212..2d0a3bd796 100644
--- a/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md
+++ b/src/OpenTelemetry.Instrumentation.Process/CHANGELOG.md
@@ -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".
diff --git a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs
index 2e1564764c..b724c3d308 100644
--- a/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs
+++ b/src/OpenTelemetry.Instrumentation.Process/ProcessMetrics.cs
@@ -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",
diff --git a/src/OpenTelemetry.Instrumentation.Process/README.md b/src/OpenTelemetry.Instrumentation.Process/README.md
index b73b99e3d8..6d3562b42a 100644
--- a/src/OpenTelemetry.Instrumentation.Process/README.md
+++ b/src/OpenTelemetry.Instrumentation.Process/README.md
@@ -61,8 +61,10 @@ allocated for the associated process.
### process.memory.virtual
-The amount of virtual memory allocated for this process
-that cannot be shared with other processes.
+The amount of committed virtual memory for this process.
+One way to think of this is all the address space this process can read from
+without trigerring an access violation; this includes memory backed solely by RAM,
+by a swapfile/pagefile and by other mapped files on disk.
| Units | Instrument Type | Value Type |
|-------|-------------------------|------------|
@@ -70,8 +72,8 @@ that cannot be shared with other processes.
The API used to retrieve the value is:
-* [Process.WorkingSet64](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.privatememorysize64):
-Gets the amount of private memory, in bytes,
+* [Process.VirtualMemorySize64](https://learn.microsoft.com/dotnet/api/system.diagnostics.process.virtualmemorysize64):
+Gets the amount of the virtual memory, in bytes,
allocated for the associated process.
### process.cpu.time
diff --git a/src/OpenTelemetry.Instrumentation.Quartz/README.md b/src/OpenTelemetry.Instrumentation.Quartz/README.md
index 6967b65841..da549407b2 100644
--- a/src/OpenTelemetry.Instrumentation.Quartz/README.md
+++ b/src/OpenTelemetry.Instrumentation.Quartz/README.md
@@ -70,7 +70,7 @@ x.AddQuartzInstrumentation(
```
For full operation list please see:
-[OperationName](../OpenTelemetry.Instrumentation.Quartz/Implementation/OperationName.cs).
+[OperationName](OperationName.cs).
All operations are enabled by default.
diff --git a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md
index 5b109755fb..167cae9ff4 100644
--- a/src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md
+++ b/src/OpenTelemetry.Instrumentation.StackExchangeRedis/README.md
@@ -13,7 +13,7 @@ and collects traces about outgoing calls to Redis.
[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
@@ -42,7 +42,7 @@ to make Redis calls. Only those Redis calls made using the same instance of the
The following example demonstrates adding StackExchange.Redis instrumentation to
a console application. This example also sets up the OpenTelemetry Console
exporter, which requires adding the package
-[`OpenTelemetry.Exporter.Console`](../OpenTelemetry.Exporter.Console/README.md)
+[`OpenTelemetry.Exporter.Console`](https://github.com/open-telemetry/opentelemetry-dotnet/blob/main/src/OpenTelemetry.Exporter.Console/README.md)
to the application.
```csharp
@@ -65,7 +65,7 @@ public class Program
For an ASP.NET Core application, adding instrumentation is typically done in
the `ConfigureServices` of your `Startup` class. Refer to documentation for
-[OpenTelemetry.Instrumentation.AspNetCore](../OpenTelemetry.Instrumentation.AspNetCore/README.md).
+[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](../OpenTelemetry.Instrumentation.AspNet/README.md).
diff --git a/test/OpenTelemetry.Extensions.Tests/ActivityEventAttachingLogProcessorTests.cs b/test/OpenTelemetry.Extensions.Tests/ActivityEventAttachingLogProcessorTests.cs
index 25dbbb6f8e..ee0e28f688 100644
--- a/test/OpenTelemetry.Extensions.Tests/ActivityEventAttachingLogProcessorTests.cs
+++ b/test/OpenTelemetry.Extensions.Tests/ActivityEventAttachingLogProcessorTests.cs
@@ -32,9 +32,6 @@ public sealed class ActivityEventAttachingLogProcessorTests : IDisposable
ShouldListenTo = source => true,
};
- private readonly ILogger logger;
- private readonly ILoggerFactory loggerFactory;
- private OpenTelemetryLoggerOptions options;
private bool sampled;
public ActivityEventAttachingLogProcessorTests()
@@ -47,25 +44,12 @@ public ActivityEventAttachingLogProcessorTests()
};
ActivitySource.AddActivityListener(this.activityListener);
-
- this.loggerFactory = LoggerFactory.Create(builder =>
- {
- builder.AddOpenTelemetry(options =>
- {
- this.options = options;
- options.AttachLogsToActivityEvent();
- });
- builder.AddFilter(typeof(ActivityEventAttachingLogProcessorTests).FullName, LogLevel.Trace);
- });
-
- this.logger = this.loggerFactory.CreateLogger();
}
public void Dispose()
{
this.activitySource.Dispose();
this.activityListener.Dispose();
- this.loggerFactory.Dispose();
}
[Theory]
@@ -82,24 +66,34 @@ public void AttachLogsToActivityEventTest(
bool recordException = false)
{
this.sampled = sampled;
- this.options.IncludeFormattedMessage = includeFormattedMessage;
- this.options.ParseStateValues = parseStateValues;
- this.options.IncludeScopes = includeScopes;
+ using ILoggerFactory loggerFactory = LoggerFactory.Create(builder =>
+ {
+ builder.AddOpenTelemetry(options =>
+ {
+ options.IncludeScopes = includeScopes;
+ options.IncludeFormattedMessage = includeFormattedMessage;
+ options.ParseStateValues = parseStateValues;
+ options.AttachLogsToActivityEvent();
+ });
+ builder.AddFilter(typeof(ActivityEventAttachingLogProcessorTests).FullName, LogLevel.Trace);
+ });
+
+ ILogger logger = loggerFactory.CreateLogger();
Activity activity = this.activitySource.StartActivity("Test");
- using IDisposable scope = this.logger.BeginScope("{NodeId}", 99);
+ using IDisposable scope = logger.BeginScope("{NodeId}", 99);
- this.logger.LogInformation(eventId, "Hello OpenTelemetry {UserId}!", 8);
+ logger.LogInformation(eventId, "Hello OpenTelemetry {UserId}!", 8);
Activity innerActivity = null;
if (recordException)
{
innerActivity = this.activitySource.StartActivity("InnerTest");
- using IDisposable innerScope = this.logger.BeginScope("{RequestId}", "1234");
+ using IDisposable innerScope = logger.BeginScope("{RequestId}", "1234");
- this.logger.LogError(new InvalidOperationException("Goodbye OpenTelemetry."), "Exception event.");
+ logger.LogError(new InvalidOperationException("Goodbye OpenTelemetry."), "Exception event.");
innerActivity.Dispose();
}
diff --git a/test/OpenTelemetry.Instrumentation.EventCounters.Tests/EventCountersMetricsTests.cs b/test/OpenTelemetry.Instrumentation.EventCounters.Tests/EventCountersMetricsTests.cs
index 26beba4deb..dba23b470f 100644
--- a/test/OpenTelemetry.Instrumentation.EventCounters.Tests/EventCountersMetricsTests.cs
+++ b/test/OpenTelemetry.Instrumentation.EventCounters.Tests/EventCountersMetricsTests.cs
@@ -17,6 +17,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.Tracing;
+using System.Linq;
using System.Threading.Tasks;
using OpenTelemetry.Metrics;
using Xunit;
@@ -68,7 +69,7 @@ public async Task EventCounter()
meterProvider.ForceFlush();
// Assert
- var metric = metricItems.Find(x => x.Name == "EventCounters.a.c");
+ var metric = metricItems.Find(x => x.Name == "ec.a.c");
Assert.NotNull(metric);
Assert.Equal(MetricType.DoubleGauge, metric.MetricType);
Assert.Equal(1997.0202, GetActualValue(metric));
@@ -98,7 +99,7 @@ public async Task IncrementingEventCounter()
meterProvider.ForceFlush();
// Assert
- var metric = metricItems.Find(x => x.Name == "EventCounters.b.inc-c");
+ var metric = metricItems.Find(x => x.Name == "ec.b.inc-c");
Assert.NotNull(metric);
Assert.Equal(MetricType.DoubleSum, metric.MetricType);
Assert.Equal(3, GetActualValue(metric));
@@ -126,7 +127,7 @@ public async Task PollingCounter()
meterProvider.ForceFlush();
// Assert
- var metric = metricItems.Find(x => x.Name == "EventCounters.c.poll-c");
+ var metric = metricItems.Find(x => x.Name == "ec.c.poll-c");
Assert.NotNull(metric);
Assert.Equal(MetricType.DoubleGauge, metric.MetricType);
Assert.Equal(20, GetActualValue(metric));
@@ -154,7 +155,7 @@ public async Task IncrementingPollingCounter()
meterProvider.ForceFlush();
// Assert
- var metric = metricItems.Find(x => x.Name == "EventCounters.d.inc-poll-c");
+ var metric = metricItems.Find(x => x.Name == "ec.d.inc-poll-c");
Assert.NotNull(metric);
Assert.Equal(MetricType.DoubleSum, metric.MetricType);
Assert.Equal(2, GetActualValue(metric));
@@ -184,7 +185,7 @@ public async Task EventCounterSameNameUsesNewestCreated()
meterProvider.ForceFlush();
// Assert
- var metric = metricItems.Find(x => x.Name == "EventCounters.a.c");
+ var metric = metricItems.Find(x => x.Name == "ec.a.c");
Assert.NotNull(metric);
Assert.Equal(MetricType.DoubleGauge, metric.MetricType);
@@ -214,6 +215,73 @@ public void ThrowExceptionForUnsupportedEventSources()
Assert.Equal("Use the `OpenTelemetry.Instrumentation.Runtime` or `OpenTelemetry.Instrumentation.Process` instrumentations.", ex.Message);
}
+ [Theory]
+ [InlineData("Microsoft-AspNetCore-Server-Kestrel-1", "tls-handshakes-per-second", "ec.Microsoft-AspNetCore-Server-Kestre.tls-handshakes-per-second")]
+ [InlineData("Microsoft-AspNetCore-Server-Kestrel-1", "tls-handshakes-per-sec", "ec.Microsoft-AspNetCore-Server-Kestrel-1.tls-handshakes-per-sec")]
+ [InlineData("Microsoft.AspNetCore.Http.Connections-1", "connections-stopped", "ec.Microsoft.AspNetCore.Http.Connections-1.connections-stopped")]
+ [InlineData("Microsoft.AspNetCore.Http.Connections-1", "connections-timed-out-longer", "ec.Microsoft.AspNetCore.Http.Conne.connections-timed-out-longer")]
+ [InlineData("Microsoft.AspNetCore.Http.Conn.Something", "connections-timed-out-longer", "ec.Microsoft.AspNetCore.Http.Conn.connections-timed-out-longer")]
+ [InlineData("Microsoft.AspNetCore.One.Two", "very-very-very-very-very-very-very-very-very-long-event-name", "ec.very-very-very-very-very-very-very-very-very-long-event-name")]
+ [InlineData("Microsoft.AspNetCore.One.Two", "very-very-very-very-very-very-very-very-long-event-name", "ec.Micr.very-very-very-very-very-very-very-very-long-event-name")]
+ [InlineData("Microsoft.AspNetCore.One.Two", "very-very-very-very-very-very-very-long-event-name", "ec.Microsoft.very-very-very-very-very-very-very-long-event-name")]
+ public async Task EventSourceNameShortening(string sourceName, string eventName, string expectedInstrumentName)
+ {
+ // Arrange
+ List metricItems = new();
+ EventSource source = new(sourceName);
+ IncrementingEventCounter connections = new(eventName, source);
+
+ var meterProvider = Sdk.CreateMeterProviderBuilder()
+ .AddEventCountersInstrumentation(options =>
+ {
+ options.AddEventSources(source.Name);
+ })
+ .AddInMemoryExporter(metricItems)
+ .Build();
+
+ // Act
+ connections.Increment(1);
+ await Task.Delay(Delay);
+ meterProvider.ForceFlush();
+
+ // Assert
+ Metric metric = metricItems.Find(m => m.Name == expectedInstrumentName);
+ Assert.NotNull(metric);
+ Assert.Equal(1, GetActualValue(metric));
+ }
+
+ [Fact]
+ public async Task InstrumentNameTooLong()
+ {
+ // Arrange
+ List metricItems = new();
+ EventSource source = new("source");
+
+ // ec.s. + event name is 63;
+ string veryLongEventName = new string('e', 100);
+ IncrementingEventCounter connections = new(veryLongEventName, source);
+
+ var meterProvider = Sdk.CreateMeterProviderBuilder()
+ .AddEventCountersInstrumentation(options =>
+ {
+ options.AddEventSources(source.Name);
+ })
+ .AddInMemoryExporter(metricItems)
+ .Build();
+
+ // Act
+ connections.Increment(1);
+ await Task.Delay(Delay);
+ meterProvider.ForceFlush();
+
+ // Assert
+ foreach (var item in metricItems)
+ {
+ Assert.False(item.Name.StartsWith("ec.source.ee"));
+ Assert.False(item.Name.StartsWith("ec.s.ee"));
+ }
+ }
+
// polling and eventcounter with same instrument name?
private static double GetActualValue(Metric metric)