-
Notifications
You must be signed in to change notification settings - Fork 304
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into nullable-aws-sampler-tests
- Loading branch information
Showing
38 changed files
with
756 additions
and
129 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
#nullable enable |
12 changes: 6 additions & 6 deletions
12
src/OpenTelemetry.Instrumentation.Quartz/.publicApi/netstandard2.0/PublicAPI.Unshipped.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
const OpenTelemetry.Instrumentation.Quartz.OperationName.Job.Execute = "Quartz.Job.Execute" -> string | ||
const OpenTelemetry.Instrumentation.Quartz.OperationName.Job.Veto = "Quartz.Job.Veto" -> string | ||
const OpenTelemetry.Instrumentation.Quartz.OperationName.Job.Execute = "Quartz.Job.Execute" -> string! | ||
const OpenTelemetry.Instrumentation.Quartz.OperationName.Job.Veto = "Quartz.Job.Veto" -> string! | ||
OpenTelemetry.Instrumentation.Quartz.OperationName | ||
OpenTelemetry.Instrumentation.Quartz.OperationName.Job | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.Enrich.get -> System.Action<System.Diagnostics.Activity, string, object> | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.Enrich.get -> System.Action<System.Diagnostics.Activity!, string!, object!>? | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.Enrich.set -> void | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.QuartzInstrumentationOptions() -> void | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.RecordException.get -> bool | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.RecordException.set -> void | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.TracedOperations.get -> System.Collections.Generic.HashSet<string> | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.TracedOperations.get -> System.Collections.Generic.HashSet<string!>! | ||
OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions.TracedOperations.set -> void | ||
OpenTelemetry.Trace.TraceProviderBuilderExtensions | ||
static OpenTelemetry.Trace.TraceProviderBuilderExtensions.AddQuartzInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder) -> OpenTelemetry.Trace.TracerProviderBuilder | ||
static OpenTelemetry.Trace.TraceProviderBuilderExtensions.AddQuartzInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder builder, System.Action<OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions> configure) -> OpenTelemetry.Trace.TracerProviderBuilder | ||
static OpenTelemetry.Trace.TraceProviderBuilderExtensions.AddQuartzInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder) -> OpenTelemetry.Trace.TracerProviderBuilder! | ||
static OpenTelemetry.Trace.TraceProviderBuilderExtensions.AddQuartzInstrumentation(this OpenTelemetry.Trace.TracerProviderBuilder! builder, System.Action<OpenTelemetry.Instrumentation.Quartz.QuartzInstrumentationOptions!>? configure) -> OpenTelemetry.Trace.TracerProviderBuilder! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
src/OpenTelemetry.Instrumentation.Wcf/Implementation/HttpRequestMessagePropertyWrapper.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
// <copyright file="HttpRequestMessagePropertyWrapper.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.Diagnostics; | ||
using System.Net; | ||
using System.Reflection; | ||
|
||
namespace OpenTelemetry.Instrumentation.Wcf.Implementation; | ||
|
||
/// <summary> | ||
/// This is a reflection-based wrapper around the HttpRequestMessageProperty class. It is done this way so we don't need to | ||
/// have an explicit reference to System.ServiceModel.Http.dll. If the consuming application has a reference to | ||
/// System.ServiceModel.Http.dll then the HttpRequestMessageProperty class will be available (IsHttpFunctionalityEnabled == true). | ||
/// If the consuming application does not have a reference to System.ServiceModel.Http.dll then all http-related functionality | ||
/// will be disabled (IsHttpFunctionalityEnabled == false). | ||
/// </summary> | ||
internal static class HttpRequestMessagePropertyWrapper | ||
{ | ||
private static readonly ReflectedInfo ReflectedValues = Initialize(); | ||
|
||
public static bool IsHttpFunctionalityEnabled => ReflectedValues != null; | ||
|
||
public static string Name | ||
{ | ||
get | ||
{ | ||
AssertHttpEnabled(); | ||
return ReflectedValues.Name; | ||
} | ||
} | ||
|
||
public static object CreateNew() | ||
{ | ||
AssertHttpEnabled(); | ||
return Activator.CreateInstance(ReflectedValues.Type); | ||
} | ||
|
||
public static WebHeaderCollection GetHeaders(object httpRequestMessageProperty) | ||
{ | ||
AssertHttpEnabled(); | ||
AssertIsFrameworkMessageProperty(httpRequestMessageProperty); | ||
return ReflectedValues.HeadersFetcher.Fetch(httpRequestMessageProperty); | ||
} | ||
|
||
private static ReflectedInfo Initialize() | ||
{ | ||
Type type = null; | ||
try | ||
{ | ||
type = Type.GetType( | ||
"System.ServiceModel.Channels.HttpRequestMessageProperty, System.ServiceModel, Version=0.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089", | ||
true); | ||
|
||
var headersProp = type.GetProperty("Headers", BindingFlags.Public | BindingFlags.Instance, null, typeof(WebHeaderCollection), Array.Empty<Type>(), null); | ||
if (headersProp == null) | ||
{ | ||
throw new NotSupportedException("HttpRequestMessageProperty.Headers property not found"); | ||
} | ||
|
||
var nameProp = type.GetProperty("Name", BindingFlags.Public | BindingFlags.Static, null, typeof(string), Array.Empty<Type>(), null); | ||
if (nameProp == null) | ||
{ | ||
throw new NotSupportedException("HttpRequestMessageProperty.Name property not found"); | ||
} | ||
|
||
return new ReflectedInfo | ||
{ | ||
Type = type, | ||
Name = (string)nameProp.GetValue(null), | ||
HeadersFetcher = new PropertyFetcher<WebHeaderCollection>("Headers"), | ||
}; | ||
} | ||
catch (Exception ex) | ||
{ | ||
WcfInstrumentationEventSource.Log.HttpServiceModelReflectionFailedToBind(ex, type?.Assembly); | ||
} | ||
|
||
return null; | ||
} | ||
|
||
[Conditional("DEBUG")] | ||
private static void AssertHttpEnabled() | ||
{ | ||
if (!IsHttpFunctionalityEnabled) | ||
{ | ||
throw new InvalidOperationException("Http functionality is not enabled, check IsHttpFunctionalityEnabled before calling this method"); | ||
} | ||
} | ||
|
||
[Conditional("DEBUG")] | ||
private static void AssertIsFrameworkMessageProperty(object httpRequestMessageProperty) | ||
{ | ||
AssertHttpEnabled(); | ||
if (httpRequestMessageProperty == null || !httpRequestMessageProperty.GetType().Equals(ReflectedValues.Type)) | ||
{ | ||
throw new ArgumentException("Object must be of type HttpRequestMessageProperty"); | ||
} | ||
} | ||
|
||
private sealed class ReflectedInfo | ||
{ | ||
public Type Type; | ||
public string Name; | ||
public PropertyFetcher<WebHeaderCollection> HeadersFetcher; | ||
} | ||
} |
Oops, something went wrong.