diff --git a/Google.Api.Gax.Grpc/ClientHelper.cs b/Google.Api.Gax.Grpc/ClientHelper.cs index 0ce14a7b..1ed3bf2c 100644 --- a/Google.Api.Gax.Grpc/ClientHelper.cs +++ b/Google.Api.Gax.Grpc/ClientHelper.cs @@ -64,7 +64,7 @@ public ClientHelper(Options options) { _versionCallSettings = _versionCallSettings.WithHeader(ApiVersionHeaderName, options.ApiVersion); } - _activitySource = options.ActivitySource; + _activitySource = settings.ActivitySource ?? options.ActivitySource; } /// @@ -214,7 +214,8 @@ public sealed class Options public string ApiVersion { get; set; } /// - /// The activity source to use for tracing, if any. This may be null. + /// The activity source to use for tracing, if any. This may be null. This is ignored + /// if specifies an activity source. /// Note: currently internal until we're ready to roll out OpenTelemetry support "properly". /// internal ActivitySource ActivitySource { get; set; } diff --git a/Google.Api.Gax.Grpc/ServiceSettingsBase.cs b/Google.Api.Gax.Grpc/ServiceSettingsBase.cs index 52de068f..06428ac2 100644 --- a/Google.Api.Gax.Grpc/ServiceSettingsBase.cs +++ b/Google.Api.Gax.Grpc/ServiceSettingsBase.cs @@ -7,6 +7,7 @@ using Grpc.Core; using Grpc.Core.Interceptors; +using System.Diagnostics; namespace Google.Api.Gax.Grpc { @@ -42,6 +43,7 @@ protected ServiceSettingsBase(ServiceSettingsBase existing) Scheduler = existing.Scheduler; VersionHeaderBuilder = existing.VersionHeaderBuilder.Clone(); Interceptor = existing.Interceptor; + ActivitySource = existing.ActivitySource; } /// @@ -84,5 +86,12 @@ protected ServiceSettingsBase(ServiceSettingsBase existing) /// on or after that date are aware of this property. /// public Interceptor Interceptor { get; set; } + + /// + /// An optional , which can override the default activity source used for tracing + /// calls from this client. + /// Note: currently internal until we're ready to roll out OpenTelemetry support "properly". + /// + internal ActivitySource ActivitySource { get; set; } } }