Skip to content

Commit 7db0aa0

Browse files
authored
Telemetry Options: Adds telemetry options in GA package (#4117)
* GA telemetry options and updated contract * enabe requuest level option * added request option in public contract
1 parent 4e2beda commit 7db0aa0

File tree

7 files changed

+170
-197
lines changed

7 files changed

+170
-197
lines changed

Microsoft.Azure.Cosmos/src/CosmosClientOptions.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -732,12 +732,7 @@ internal Protocol ConnectionProtocol
732732
/// <summary>
733733
/// Gets or sets Client Telemetry Options like feature flags and corresponding options
734734
/// </summary>
735-
#if PREVIEW
736-
public
737-
#else
738-
internal
739-
#endif
740-
CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; }
735+
public CosmosClientTelemetryOptions CosmosClientTelemetryOptions { get; set; }
741736

742737
internal void SetSerializerIfNotConfigured(CosmosSerializer serializer)
743738
{

Microsoft.Azure.Cosmos/src/CosmosClientTelemetryOptions.cs

Lines changed: 4 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -7,36 +7,21 @@ namespace Microsoft.Azure.Cosmos
77
/// <summary>
88
/// Telemetry Options for Cosmos Client to enable/disable telemetry and distributed tracing along with corresponding threshold values.
99
/// </summary>
10-
#if PREVIEW
11-
public
12-
#else
13-
internal
14-
#endif
15-
class CosmosClientTelemetryOptions
10+
public class CosmosClientTelemetryOptions
1611
{
1712
/// <summary>
1813
/// Disable sending telemetry to service, <see cref="Microsoft.Azure.Cosmos.CosmosThresholdOptions"/> is not applicable to this as of now.
1914
/// </summary>
2015
/// <remarks>This option will disable sending telemetry to service.even it is opt-in from portal.</remarks>
2116
/// <value>true</value>
22-
#if PREVIEW
23-
public
24-
#else
25-
internal
26-
#endif
27-
bool DisableSendingMetricsToService { get; set; } = true;
17+
public bool DisableSendingMetricsToService { get; set; } = true;
2818

2919
/// <summary>
3020
/// This method enable/disable generation of operation level <see cref="System.Diagnostics.Activity"/> if listener is subscribed to the Source Name "Azure.Cosmos.Operation".
3121
/// </summary>
3222
/// <value>false</value>
3323
/// <remarks> Please Refer https://opentelemetry.io/docs/instrumentation/net/exporters/ to know more about open telemetry exporters</remarks>
34-
#if PREVIEW
35-
public
36-
#else
37-
internal
38-
#endif
39-
bool DisableDistributedTracing { get; set; } =
24+
public bool DisableDistributedTracing { get; set; } =
4025
#if PREVIEW
4126
false;
4227
#else
@@ -47,12 +32,7 @@ class CosmosClientTelemetryOptions
4732
/// Threshold values for Distributed Tracing.
4833
/// These values decides whether to generate operation level <see cref="System.Diagnostics.Tracing.EventSource"/> with request diagnostics or not.
4934
/// </summary>
50-
#if PREVIEW
51-
public
52-
#else
53-
internal
54-
#endif
55-
CosmosThresholdOptions CosmosThresholdOptions { get; set; } = new CosmosThresholdOptions();
35+
public CosmosThresholdOptions CosmosThresholdOptions { get; set; } = new CosmosThresholdOptions();
5636

5737
}
5838
}

Microsoft.Azure.Cosmos/src/CosmosThresholdOptions.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,7 @@ namespace Microsoft.Azure.Cosmos
99
/// <summary>
1010
/// Threshold values for Distributed Tracing
1111
/// </summary>
12-
#if PREVIEW
13-
public
14-
#else
15-
internal
16-
#endif
17-
class CosmosThresholdOptions
12+
public class CosmosThresholdOptions
1813
{
1914
/// <summary>
2015
/// Latency Threshold for non point operations i.e. Query

Microsoft.Azure.Cosmos/src/Fluent/CosmosClientBuilder.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -686,12 +686,7 @@ internal CosmosClientBuilder WithRetryWithOptions(
686686
/// </summary>
687687
/// <param name="options"></param>
688688
/// <returns>The <see cref="CosmosClientBuilder"/> object</returns>
689-
#if PREVIEW
690-
public
691-
#else
692-
internal
693-
#endif
694-
CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options)
689+
public CosmosClientBuilder WithClientTelemetryOptions(CosmosClientTelemetryOptions options)
695690
{
696691
this.clientOptions.CosmosClientTelemetryOptions = options;
697692
return this;

Microsoft.Azure.Cosmos/src/RequestOptions/RequestOptions.cs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,10 @@ public class RequestOptions
6464
PriorityLevel? PriorityLevel { get; set; }
6565

6666
/// <summary>
67-
/// Set Request Level Distributed Tracing Options.
67+
/// Threshold values for Distributed Tracing.
68+
/// These values decides whether to generate operation level <see cref="System.Diagnostics.Tracing.EventSource"/> with request diagnostics or not.
6869
/// </summary>
69-
internal CosmosThresholdOptions CosmosThresholdOptions { get; set; }
70+
public CosmosThresholdOptions CosmosThresholdOptions { get; set; }
7071

7172
/// <summary>
7273
/// Gets or sets the boolean to use effective partition key routing in the cosmos db request.

Microsoft.Azure.Cosmos/tests/Microsoft.Azure.Cosmos.Tests/Contracts/DotNetPreviewSDKAPI.json

Lines changed: 0 additions & 153 deletions
Original file line numberDiff line numberDiff line change
@@ -352,148 +352,6 @@
352352
},
353353
"NestedTypes": {}
354354
},
355-
"Microsoft.Azure.Cosmos.CosmosClientOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
356-
"Subclasses": {},
357-
"Members": {
358-
"Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions CosmosClientTelemetryOptions": {
359-
"Type": "Property",
360-
"Attributes": [],
361-
"MethodInfo": "Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions CosmosClientTelemetryOptions;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions get_CosmosClientTelemetryOptions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_CosmosClientTelemetryOptions(Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
362-
},
363-
"Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions get_CosmosClientTelemetryOptions()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
364-
"Type": "Method",
365-
"Attributes": [
366-
"CompilerGeneratedAttribute"
367-
],
368-
"MethodInfo": "Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions get_CosmosClientTelemetryOptions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
369-
},
370-
"Void set_CosmosClientTelemetryOptions(Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
371-
"Type": "Method",
372-
"Attributes": [
373-
"CompilerGeneratedAttribute"
374-
],
375-
"MethodInfo": "Void set_CosmosClientTelemetryOptions(Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
376-
}
377-
},
378-
"NestedTypes": {}
379-
},
380-
"Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
381-
"Subclasses": {},
382-
"Members": {
383-
"Boolean DisableDistributedTracing": {
384-
"Type": "Property",
385-
"Attributes": [],
386-
"MethodInfo": "Boolean DisableDistributedTracing;CanRead:True;CanWrite:True;Boolean get_DisableDistributedTracing();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DisableDistributedTracing(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
387-
},
388-
"Boolean DisableSendingMetricsToService": {
389-
"Type": "Property",
390-
"Attributes": [],
391-
"MethodInfo": "Boolean DisableSendingMetricsToService;CanRead:True;CanWrite:True;Boolean get_DisableSendingMetricsToService();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_DisableSendingMetricsToService(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
392-
},
393-
"Boolean get_DisableDistributedTracing()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
394-
"Type": "Method",
395-
"Attributes": [
396-
"CompilerGeneratedAttribute"
397-
],
398-
"MethodInfo": "Boolean get_DisableDistributedTracing();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
399-
},
400-
"Boolean get_DisableSendingMetricsToService()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
401-
"Type": "Method",
402-
"Attributes": [
403-
"CompilerGeneratedAttribute"
404-
],
405-
"MethodInfo": "Boolean get_DisableSendingMetricsToService();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
406-
},
407-
"Microsoft.Azure.Cosmos.CosmosThresholdOptions CosmosThresholdOptions": {
408-
"Type": "Property",
409-
"Attributes": [],
410-
"MethodInfo": "Microsoft.Azure.Cosmos.CosmosThresholdOptions CosmosThresholdOptions;CanRead:True;CanWrite:True;Microsoft.Azure.Cosmos.CosmosThresholdOptions get_CosmosThresholdOptions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_CosmosThresholdOptions(Microsoft.Azure.Cosmos.CosmosThresholdOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
411-
},
412-
"Microsoft.Azure.Cosmos.CosmosThresholdOptions get_CosmosThresholdOptions()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
413-
"Type": "Method",
414-
"Attributes": [
415-
"CompilerGeneratedAttribute"
416-
],
417-
"MethodInfo": "Microsoft.Azure.Cosmos.CosmosThresholdOptions get_CosmosThresholdOptions();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
418-
},
419-
"Void .ctor()": {
420-
"Type": "Constructor",
421-
"Attributes": [],
422-
"MethodInfo": "[Void .ctor(), Void .ctor()]"
423-
},
424-
"Void set_CosmosThresholdOptions(Microsoft.Azure.Cosmos.CosmosThresholdOptions)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
425-
"Type": "Method",
426-
"Attributes": [
427-
"CompilerGeneratedAttribute"
428-
],
429-
"MethodInfo": "Void set_CosmosThresholdOptions(Microsoft.Azure.Cosmos.CosmosThresholdOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
430-
},
431-
"Void set_DisableDistributedTracing(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
432-
"Type": "Method",
433-
"Attributes": [
434-
"CompilerGeneratedAttribute"
435-
],
436-
"MethodInfo": "Void set_DisableDistributedTracing(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
437-
},
438-
"Void set_DisableSendingMetricsToService(Boolean)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
439-
"Type": "Method",
440-
"Attributes": [
441-
"CompilerGeneratedAttribute"
442-
],
443-
"MethodInfo": "Void set_DisableSendingMetricsToService(Boolean);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
444-
}
445-
},
446-
"NestedTypes": {}
447-
},
448-
"Microsoft.Azure.Cosmos.CosmosThresholdOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
449-
"Subclasses": {},
450-
"Members": {
451-
"System.TimeSpan get_NonPointOperationLatencyThreshold()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
452-
"Type": "Method",
453-
"Attributes": [
454-
"CompilerGeneratedAttribute"
455-
],
456-
"MethodInfo": "System.TimeSpan get_NonPointOperationLatencyThreshold();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
457-
},
458-
"System.TimeSpan get_PointOperationLatencyThreshold()[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
459-
"Type": "Method",
460-
"Attributes": [
461-
"CompilerGeneratedAttribute"
462-
],
463-
"MethodInfo": "System.TimeSpan get_PointOperationLatencyThreshold();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
464-
},
465-
"System.TimeSpan NonPointOperationLatencyThreshold": {
466-
"Type": "Property",
467-
"Attributes": [],
468-
"MethodInfo": "System.TimeSpan NonPointOperationLatencyThreshold;CanRead:True;CanWrite:True;System.TimeSpan get_NonPointOperationLatencyThreshold();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_NonPointOperationLatencyThreshold(System.TimeSpan);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
469-
},
470-
"System.TimeSpan PointOperationLatencyThreshold": {
471-
"Type": "Property",
472-
"Attributes": [],
473-
"MethodInfo": "System.TimeSpan PointOperationLatencyThreshold;CanRead:True;CanWrite:True;System.TimeSpan get_PointOperationLatencyThreshold();IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;Void set_PointOperationLatencyThreshold(System.TimeSpan);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
474-
},
475-
"Void .ctor()": {
476-
"Type": "Constructor",
477-
"Attributes": [],
478-
"MethodInfo": "[Void .ctor(), Void .ctor()]"
479-
},
480-
"Void set_NonPointOperationLatencyThreshold(System.TimeSpan)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
481-
"Type": "Method",
482-
"Attributes": [
483-
"CompilerGeneratedAttribute"
484-
],
485-
"MethodInfo": "Void set_NonPointOperationLatencyThreshold(System.TimeSpan);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
486-
},
487-
"Void set_PointOperationLatencyThreshold(System.TimeSpan)[System.Runtime.CompilerServices.CompilerGeneratedAttribute()]": {
488-
"Type": "Method",
489-
"Attributes": [
490-
"CompilerGeneratedAttribute"
491-
],
492-
"MethodInfo": "Void set_PointOperationLatencyThreshold(System.TimeSpan);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
493-
}
494-
},
495-
"NestedTypes": {}
496-
},
497355
"Microsoft.Azure.Cosmos.DedicatedGatewayRequestOptions;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
498356
"Subclasses": {},
499357
"Members": {
@@ -568,17 +426,6 @@
568426
},
569427
"NestedTypes": {}
570428
},
571-
"Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder;System.Object;IsAbstract:False;IsSealed:False;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
572-
"Subclasses": {},
573-
"Members": {
574-
"Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithClientTelemetryOptions(Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions)": {
575-
"Type": "Method",
576-
"Attributes": [],
577-
"MethodInfo": "Microsoft.Azure.Cosmos.Fluent.CosmosClientBuilder WithClientTelemetryOptions(Microsoft.Azure.Cosmos.CosmosClientTelemetryOptions);IsAbstract:False;IsStatic:False;IsVirtual:False;IsGenericMethod:False;IsConstructor:False;IsFinal:False;"
578-
}
579-
},
580-
"NestedTypes": {}
581-
},
582429
"Microsoft.Azure.Cosmos.Linq.CosmosLinqExtensions;System.Object;IsAbstract:True;IsSealed:True;IsInterface:False;IsEnum:False;IsClass:True;IsValueType:False;IsNested:False;IsGenericType:False;IsSerializable:False": {
583430
"Subclasses": {},
584431
"Members": {

0 commit comments

Comments
 (0)