Skip to content

Commit d1c54ce

Browse files
authored
Merge branch 'main' into opamp-client-wstransport
2 parents 4dd9658 + 3f072fa commit d1c54ce

File tree

26 files changed

+182
-457
lines changed

26 files changed

+182
-457
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ jobs:
4141
show-progress: false
4242

4343
- name: Initialize CodeQL
44-
uses: github/codeql-action/init@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.29.5
44+
uses: github/codeql-action/init@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.29.5
4545
with:
4646
build-mode: none
4747
languages: ${{ matrix.language }}
4848

4949
- name: Perform CodeQL Analysis
50-
uses: github/codeql-action/analyze@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.29.5
50+
uses: github/codeql-action/analyze@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.29.5
5151
with:
5252
category: '/language:${{ matrix.language }}'
5353

.github/workflows/ossf-scorecard.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,6 @@ jobs:
4242
# Upload the results to GitHub's code scanning dashboard (optional).
4343
# Commenting out will disable upload of results to your repo's Code Scanning dashboard
4444
- name: "Upload to code-scanning"
45-
uses: github/codeql-action/upload-sarif@2d92b76c45b91eb80fc44c74ce3fce0ee94e8f9d # v3.29.5
45+
uses: github/codeql-action/upload-sarif@f1f6e5f6af878fb37288ce1c627459e94dbf7d01 # v3.29.5
4646
with:
4747
sarif_file: results.sarif

src/OpenTelemetry.Instrumentation.AspNet/.publicApi/PublicAPI.Unshipped.txt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions
22
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.AspNetMetricsInstrumentationOptions() -> void
3-
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.Enrich.get -> OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichFunc?
4-
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.Enrich.set -> void
5-
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichFunc
3+
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichWithHttpContext.get -> OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichWithHttpContextAction?
4+
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichWithHttpContext.set -> void
5+
OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichWithHttpContextAction
66
OpenTelemetry.Instrumentation.AspNet.AspNetTraceInstrumentationOptions
77
OpenTelemetry.Instrumentation.AspNet.AspNetTraceInstrumentationOptions.AspNetTraceInstrumentationOptions() -> void
88
OpenTelemetry.Instrumentation.AspNet.AspNetTraceInstrumentationOptions.EnrichWithException.get -> System.Action<System.Diagnostics.Activity!, System.Exception!>?
@@ -21,4 +21,4 @@ static OpenTelemetry.Metrics.AspNetInstrumentationMeterProviderBuilderExtensions
2121
static OpenTelemetry.Metrics.AspNetInstrumentationMeterProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Metrics.MeterProviderBuilder! builder, System.Action<OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions!>? configure) -> OpenTelemetry.Metrics.MeterProviderBuilder!
2222
static OpenTelemetry.Trace.AspNetInstrumentationTracerProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder) -> OpenTelemetry.Trace.TracerProviderBuilder!
2323
static OpenTelemetry.Trace.AspNetInstrumentationTracerProviderBuilderExtensions.AddAspNetInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder, System.Action<OpenTelemetry.Instrumentation.AspNet.AspNetTraceInstrumentationOptions!>? configure) -> OpenTelemetry.Trace.TracerProviderBuilder!
24-
virtual OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichFunc.Invoke(System.Web.HttpContext! context, ref System.Diagnostics.TagList tags) -> void
24+
virtual OpenTelemetry.Instrumentation.AspNet.AspNetMetricsInstrumentationOptions.EnrichWithHttpContextAction.Invoke(System.Web.HttpContext! context, ref System.Diagnostics.TagList tags) -> void

src/OpenTelemetry.Instrumentation.AspNet/AspNetMetricsInstrumentationOptions.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,12 +16,12 @@ public sealed class AspNetMetricsInstrumentationOptions
1616
/// </summary>
1717
/// <param name="context"><see cref="HttpContext"/>: the HttpContext object. Both Request and Response are available.</param>
1818
/// <param name="tags"><see cref="TagList"/>: List of current tags. You can add additional tags to this list. </param>
19-
public delegate void EnrichFunc(HttpContext context, ref TagList tags);
19+
public delegate void EnrichWithHttpContextAction(HttpContext context, ref TagList tags);
2020

2121
/// <summary>
22-
/// Gets or sets a function to enrich a recorded metric with additional custom tags.
22+
/// Gets or sets a delegate to enrich a recorded metric with additional custom tags.
2323
/// </summary>
24-
public EnrichFunc? Enrich { get; set; }
24+
public EnrichWithHttpContextAction? EnrichWithHttpContext { get; set; }
2525

2626
/// <summary>
2727
/// Gets or sets a value indicating whether emit `server.address` and `server.port` attributes.

src/OpenTelemetry.Instrumentation.AspNet/CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,19 @@
77
`AspNetInstrumentationMeterProviderBuilderExtensions`
88
and `AspNetInstrumentationTracerProviderBuilderExtensions` respectively.
99
([#2910](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2910))
10+
1011
* **Breaking Change**: Made metrics generation independent from traces.
1112
Tracing must no longer be enabled to calculate metrics. A compatible version
1213
of `OpenTelemetry.Instrumentation.AspNet.TelemetryHttpModule` is required.
1314
([#2970](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/2970))
1415

16+
* **Breaking Change**: Metrics related option renamed:
17+
* delegate `AspNetMetricsInstrumentationOptions.EnrichFunc` to
18+
`AspNetMetricsInstrumentationOptions.EnrichWithHttpContextAction`,
19+
* property `AspNetMetricsInstrumentationOptions.Enrich` to
20+
`AspNetMetricsInstrumentationOptions.EnrichWithHttpContext`.
21+
([#3070](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3070))
22+
1523
## 1.12.0-beta.1
1624

1725
Released 2025-May-05

src/OpenTelemetry.Instrumentation.AspNet/Implementation/HttpInListener.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -94,11 +94,11 @@ private void RecordDuration(Activity? activity, HttpContext context, Exception?
9494
tags.Add(SemanticConventions.AttributeHttpRoute, template);
9595
}
9696

97-
if (options.Enrich is not null)
97+
if (options.EnrichWithHttpContext is not null)
9898
{
9999
try
100100
{
101-
options.Enrich(context, ref tags);
101+
options.EnrichWithHttpContext(context, ref tags);
102102
}
103103
catch (Exception ex)
104104
{

src/OpenTelemetry.Instrumentation.EntityFrameworkCore/.publicApi/PublicAPI.Unshipped.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentation
44
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.Filter.set -> void
55
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.SetDbQueryParameters.get -> bool
66
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.SetDbQueryParameters.set -> void
7-
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.SetDbStatementForStoredProcedure.get -> bool
8-
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.SetDbStatementForStoredProcedure.set -> void
9-
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.SetDbStatementForText.get -> bool
10-
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.SetDbStatementForText.set -> void
117
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.EnrichWithIDbCommand.get -> System.Action<System.Diagnostics.Activity!, System.Data.IDbCommand!>?
128
OpenTelemetry.Instrumentation.EntityFrameworkCore.EntityFrameworkInstrumentationOptions.EnrichWithIDbCommand.set -> void
139
OpenTelemetry.Trace.TracerProviderBuilderExtensions

src/OpenTelemetry.Instrumentation.EntityFrameworkCore/CHANGELOG.md

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,16 @@
2121
* Add the `db.query.summary` attribute and use it for the trace span name when opted
2222
into using the `OTEL_SEMCONV_STABILITY_OPT_IN` environment variable.
2323
([#3022](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3022))
24-
* The `db.statement` and `db.query.text` attributes added when `SetDbStatementForText`
25-
is `true` are now sanitized when using specific SQL-like EFCore providers.
24+
* The `db.statement` and `db.query.text` attributes are now sanitized when using
25+
specific SQL-like EFCore providers.
2626
([#3022](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3022))
27+
* **Breaking change**: The `SetDbStatementForStoredProcedure` and
28+
`SetDbStatementForText` properties have been removed. Behaviors related to this
29+
option are now always enabled.
30+
([#3072](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3072))
31+
* **Breaking change**: `db.system.name` now only sets names that are explicitly
32+
defined in the Semantic Conventions for databases.
33+
([#3075](https://github.com/open-telemetry/opentelemetry-dotnet-contrib/pull/3075))
2734

2835
## 1.12.0-beta.2
2936

src/OpenTelemetry.Instrumentation.EntityFrameworkCore/EntityFrameworkInstrumentationOptions.cs

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,6 @@ internal EntityFrameworkInstrumentationOptions(IConfiguration configuration)
2828
this.EmitNewAttributes = databaseSemanticConvention.HasFlag(DatabaseSemanticConvention.New);
2929
}
3030

31-
/// <summary>
32-
/// Gets or sets a value indicating whether or not the <see cref="EntityFrameworkInstrumentation"/> should add the names of <see cref="CommandType.StoredProcedure"/> commands as the <see cref="Trace.SemanticConventions.AttributeDbStatement"/> tag. Default value: True.
33-
/// </summary>
34-
public bool SetDbStatementForStoredProcedure { get; set; } = true;
35-
36-
/// <summary>
37-
/// Gets or sets a value indicating whether or not the <see cref="EntityFrameworkInstrumentation"/> should add the text of <see cref="CommandType.Text"/> commands as the <see cref="Trace.SemanticConventions.AttributeDbStatement"/> tag. Default value: False.
38-
/// </summary>
39-
public bool SetDbStatementForText { get; set; }
40-
4131
/// <summary>
4232
/// Gets or sets an action to enrich an Activity from the db command.
4333
/// </summary>

src/OpenTelemetry.Instrumentation.EntityFrameworkCore/Implementation/EntityFrameworkDiagnosticListener.cs

Lines changed: 16 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -165,32 +165,24 @@ public override void OnEventWritten(string name, object? payload)
165165
switch (commandType)
166166
{
167167
case CommandType.StoredProcedure:
168-
if (this.options.SetDbStatementForStoredProcedure)
169-
{
170-
DatabaseSemanticConventionHelper.ApplyConventionsForStoredProcedure(
171-
activity,
172-
commandText,
173-
this.options.EmitOldAttributes,
174-
this.options.EmitNewAttributes);
175-
}
176-
168+
DatabaseSemanticConventionHelper.ApplyConventionsForStoredProcedure(
169+
activity,
170+
commandText,
171+
this.options.EmitOldAttributes,
172+
this.options.EmitNewAttributes);
177173
break;
178174

179175
case CommandType.Text:
180-
if (this.options.SetDbStatementForText)
181-
{
182-
// Only SQL-like providers support sanitization as we are not
183-
// able to sanitize arbitrary commands for other query dialects.
184-
bool sanitizeQuery = IsSqlLikeProvider(providerName);
185-
186-
DatabaseSemanticConventionHelper.ApplyConventionsForQueryText(
187-
activity,
188-
commandText,
189-
this.options.EmitOldAttributes,
190-
this.options.EmitNewAttributes,
191-
sanitizeQuery);
192-
}
193-
176+
// Only SQL-like providers support sanitization as we are not
177+
// able to sanitize arbitrary commands for other query dialects.
178+
bool sanitizeQuery = IsSqlLikeProvider(providerName);
179+
180+
DatabaseSemanticConventionHelper.ApplyConventionsForQueryText(
181+
activity,
182+
commandText,
183+
this.options.EmitOldAttributes,
184+
this.options.EmitNewAttributes,
185+
sanitizeQuery);
194186
break;
195187

196188
case CommandType.TableDirect:
@@ -286,7 +278,7 @@ public override void OnEventWritten(string name, object? payload)
286278
/// A tuple containing the respective <c>db.system</c> and <c>db.system.name</c> values.
287279
/// </returns>
288280
internal static (string Old, string New) GetDbSystemNames(string? providerOrCommandName) =>
289-
//// "${Attribute} has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used."
281+
//// "${Attribute} has the following list of well-known values. If one of them applies, then the respective value MUST be used"
290282
providerOrCommandName switch
291283
{
292284
//// These names are defined in the Semantic Conventions
@@ -334,23 +326,6 @@ internal static (string Old, string New) GetDbSystemNames(string? providerOrComm
334326
"IBM.EntityFrameworkCore-lnx" or
335327
"IBM.EntityFrameworkCore-osx"
336328
=> (DbSystems.Db2, DbSystemNames.IbmDb2),
337-
//// These names are custom and are retained for backwards compatibility
338-
"EFCore.Snowflake" or
339-
"EFCore.Snowflake.Storage" or
340-
"EFCore.Snowflake.Storage.Internal"
341-
=> ("snowflake", "snowflake"),
342-
"Microsoft.EntityFrameworkCore.InMemory"
343-
=> ("efcoreinmemory", "efcoreinmemory"),
344-
"FileContextCore"
345-
=> ("filecontextcore", "filecontextcore"),
346-
"EntityFrameworkCore.SqlServerCompact35" or
347-
"EntityFrameworkCore.SqlServerCompact40" or
348-
"System.Data.SqlServerCe.SqlCeCommand"
349-
=> ("mssqlcompact", "mssqlcompact"),
350-
"EntityFrameworkCore.OpenEdge" => ("openedge", "openedge"),
351-
"EntityFrameworkCore.Jet" or
352-
"EntityFrameworkCore.Jet.Data.JetCommand"
353-
=> ("jet", "jet"),
354329
//// Otherwise use the fallback defined in the Semantic Conventions
355330
_ => (DbSystems.OtherSql, DbSystemNames.OtherSql),
356331
};

0 commit comments

Comments
 (0)