|
4 | 4 |
|
5 | 5 | namespace Microsoft.Azure.Cosmos.Telemetry
|
6 | 6 | {
|
| 7 | + /// <summary> |
| 8 | + /// Contains constant string values representing OpenTelemetry attribute keys for monitoring and tracing Cosmos DB operations. |
| 9 | + /// These keys follow the OpenTelemetry conventions and the Cosmos DB semantic conventions as outlined in the OpenTelemetry specification. |
| 10 | + /// </summary> |
| 11 | + /// <remarks> |
| 12 | + /// For more details on the semantic conventions, refer to the OpenTelemetry documentation at: |
| 13 | + /// <see href="https://opentelemetry.io/docs/specs/semconv/database/cosmosdb/"/> |
| 14 | + /// </remarks> |
7 | 15 | internal sealed class OpenTelemetryAttributeKeys
|
8 | 16 | {
|
9 | 17 | // Azure defaults
|
| 18 | + |
| 19 | + /// <summary> |
| 20 | + /// Represents the diagnostic namespace for Azure Cosmos. |
| 21 | + /// </summary> |
10 | 22 | public const string DiagnosticNamespace = "Azure.Cosmos";
|
| 23 | + |
| 24 | + /// <summary> |
| 25 | + /// Represents the resource provider namespace for Azure Cosmos. |
| 26 | + /// </summary> |
11 | 27 | public const string ResourceProviderNamespace = "Microsoft.DocumentDB";
|
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Represents the prefix for operation names. |
| 31 | + /// </summary> |
12 | 32 | public const string OperationPrefix = "Operation";
|
| 33 | + |
| 34 | + /// <summary> |
| 35 | + /// Represents the prefix for network-level operations. |
| 36 | + /// </summary> |
13 | 37 | public const string NetworkLevelPrefix = "Request";
|
14 | 38 |
|
15 | 39 | // Common database attributes
|
| 40 | + |
| 41 | + /// <summary> |
| 42 | + /// Represents the name of the database system. |
| 43 | + /// </summary> |
16 | 44 | public const string DbSystemName = "db.system";
|
17 |
| - public const string DbName = "db.name"; |
18 |
| - public const string DbOperation = "db.operation"; |
| 45 | + |
| 46 | + /// <summary> |
| 47 | + /// Represents the namespace of the database. |
| 48 | + /// </summary> |
| 49 | + public const string DbName = "db.namespace"; |
| 50 | + |
| 51 | + /// <summary> |
| 52 | + /// Represents the name of the database operation. |
| 53 | + /// </summary> |
| 54 | + public const string DbOperation = "db.operation.name"; |
| 55 | + |
| 56 | + /// <summary> |
| 57 | + /// Represents the server address. |
| 58 | + /// </summary> |
19 | 59 | public const string ServerAddress = "server.address";
|
20 | 60 |
|
21 |
| - // Cosmos Db Specific |
| 61 | + // Cosmos DB specific attributes |
| 62 | + |
| 63 | + /// <summary> |
| 64 | + /// Represents the client ID for Cosmos DB. |
| 65 | + /// </summary> |
22 | 66 | public const string ClientId = "db.cosmosdb.client_id";
|
| 67 | + |
| 68 | + /// <summary> |
| 69 | + /// Represents the machine ID for Cosmos DB. |
| 70 | + /// </summary> |
23 | 71 | public const string MachineId = "db.cosmosdb.machine_id";
|
24 |
| - public const string UserAgent = "user_agent.original"; // Compliant with open telemetry conventions |
| 72 | + |
| 73 | + /// <summary> |
| 74 | + /// Represents the user agent, compliant with OpenTelemetry conventions. |
| 75 | + /// </summary> |
| 76 | + public const string UserAgent = "user_agent.original"; |
| 77 | + |
| 78 | + /// <summary> |
| 79 | + /// Represents the connection mode for Cosmos DB. |
| 80 | + /// </summary> |
25 | 81 | public const string ConnectionMode = "db.cosmosdb.connection_mode";
|
| 82 | + |
| 83 | + /// <summary> |
| 84 | + /// Represents the type of operation for Cosmos DB. |
| 85 | + /// </summary> |
26 | 86 | public const string OperationType = "db.cosmosdb.operation_type";
|
27 | 87 |
|
28 |
| - // Request/Response Specifics |
29 |
| - public const string ContainerName = "db.cosmosdb.container"; |
30 |
| - public const string RequestContentLength = "db.cosmosdb.request_content_length_bytes"; |
31 |
| - public const string ResponseContentLength = "db.cosmosdb.response_content_length_bytes"; |
| 88 | + // Request/Response specifics |
| 89 | + |
| 90 | + /// <summary> |
| 91 | + /// Represents the name of the container in Cosmos DB. |
| 92 | + /// </summary> |
| 93 | + public const string ContainerName = "db.collection.name"; |
| 94 | + |
| 95 | + /// <summary> |
| 96 | + /// Represents the content length of the request. |
| 97 | + /// </summary> |
| 98 | + public const string RequestContentLength = "db.cosmosdb.request_content_length"; |
| 99 | + |
| 100 | + /// <summary> |
| 101 | + /// Represents the content length of the response. |
| 102 | + /// </summary> |
| 103 | + public const string ResponseContentLength = "db.cosmosdb.response_content_length"; |
| 104 | + |
| 105 | + /// <summary> |
| 106 | + /// Represents the status code of the response. |
| 107 | + /// </summary> |
32 | 108 | public const string StatusCode = "db.cosmosdb.status_code";
|
| 109 | + |
| 110 | + /// <summary> |
| 111 | + /// Represents the sub-status code of the response. |
| 112 | + /// </summary> |
33 | 113 | public const string SubStatusCode = "db.cosmosdb.sub_status_code";
|
| 114 | + |
| 115 | + /// <summary> |
| 116 | + /// Represents the request charge for the operation. |
| 117 | + /// </summary> |
34 | 118 | public const string RequestCharge = "db.cosmosdb.request_charge";
|
| 119 | + |
| 120 | + /// <summary> |
| 121 | + /// Represents the regions contacted for the operation. |
| 122 | + /// </summary> |
35 | 123 | public const string Region = "db.cosmosdb.regions_contacted";
|
| 124 | + |
| 125 | + /// <summary> |
| 126 | + /// Represents the item count in the operation. |
| 127 | + /// </summary> |
36 | 128 | public const string ItemCount = "db.cosmosdb.item_count";
|
| 129 | + |
| 130 | + /// <summary> |
| 131 | + /// Represents the activity ID for the operation. |
| 132 | + /// </summary> |
37 | 133 | public const string ActivityId = "db.cosmosdb.activity_id";
|
| 134 | + |
| 135 | + /// <summary> |
| 136 | + /// Represents the correlated activity ID for the operation. |
| 137 | + /// </summary> |
38 | 138 | public const string CorrelatedActivityId = "db.cosmosdb.correlated_activity_id";
|
39 |
| - public const string BatchSize = "db.cosmosdb.batch_size"; |
| 139 | + |
| 140 | + /// <summary> |
| 141 | + /// Represents the size of the batch operation. |
| 142 | + /// </summary> |
| 143 | + public const string BatchSize = "db.operation.batch.size"; |
40 | 144 |
|
41 | 145 | // Exceptions
|
| 146 | + |
| 147 | + /// <summary> |
| 148 | + /// Represents the type of exception. |
| 149 | + /// </summary> |
42 | 150 | public const string ExceptionType = "exception.type";
|
| 151 | + |
| 152 | + /// <summary> |
| 153 | + /// Represents the message of the exception. |
| 154 | + /// </summary> |
43 | 155 | public const string ExceptionMessage = "exception.message";
|
| 156 | + |
| 157 | + /// <summary> |
| 158 | + /// Represents the stack trace of the exception. |
| 159 | + /// </summary> |
44 | 160 | public const string ExceptionStacktrace = "exception.stacktrace";
|
45 | 161 | }
|
46 | 162 | }
|
0 commit comments