Skip to content

Commit

Permalink
[INTERNAL] Diagnostics: Fixes system history to be actual json in the…
Browse files Browse the repository at this point in the history
… diagnostics (#2722)

This fixes the system usage to be actual json instead of a string which json that has been escaped.
  • Loading branch information
j82w authored Sep 10, 2021
1 parent 4eb8e20 commit 5106255
Show file tree
Hide file tree
Showing 14 changed files with 650 additions and 14 deletions.
2 changes: 1 addition & 1 deletion Microsoft.Azure.Cosmos/src/Handler/DiagnosticsHandler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public override async Task<ResponseMessage> SendAsync(
if (systemUsageHistory != null)
{
request.Trace.AddDatum(
"CPU Load History",
"System Info",
new CpuHistoryTraceDatum(systemUsageHistory));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -352,12 +352,15 @@ private void VisitStoreResponseStatistics(

public void Visit(CpuHistoryTraceDatum cpuHistoryTraceDatum)
{
this.jsonWriter.WriteObjectStart();

this.jsonWriter.WriteFieldName("CPU History");
this.jsonWriter.WriteStringValue(cpuHistoryTraceDatum.Value.ToString());

this.jsonWriter.WriteObjectEnd();
if (this.jsonWriter is IJsonTextWriterExtensions jsonTextWriter)
{
jsonTextWriter.WriteRawJsonValue(Encoding.UTF8.GetBytes(cpuHistoryTraceDatum.Value.ToString()),
isFieldName: false);
}
else
{
throw new NotImplementedException("Writing Raw Json directly to the buffer is currently only supported for text and not for binary, hybridrow");
}
}

public void Visit(ClientConfigurationTraceDatum clientConfigurationTraceDatum)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,10 @@
└── Execute Batch Request(00000000-0000-0000-0000-000000000000) Batch-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
├── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ (
│ │ [System Info]
│ │ Redacted To Not Change The Baselines From Run To Run
│ │ )
│ └── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -112,6 +116,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
├── Waiting for Initialization of client to complete(00000000-0000-0000-0000-000000000000) Unknown-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.EmulatorTests.Tracing.EndToEndTraceWriterBaselineTests+RequestHandlerSleepHelper(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ (
│ [System Info]
│ Redacted To Not Change The Baselines From Run To Run
│ )
└── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -82,6 +86,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down Expand Up @@ -153,6 +160,10 @@
│ )
└── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ (
│ [System Info]
│ Redacted To Not Change The Baselines From Run To Run
│ )
└── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
└── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -189,6 +200,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@
│ )
├── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ (
│ │ [System Info]
│ │ Redacted To Not Change The Baselines From Run To Run
│ │ )
│ └── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -147,6 +151,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down Expand Up @@ -264,6 +271,10 @@
│ )
├── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ (
│ │ [System Info]
│ │ Redacted To Not Change The Baselines From Run To Run
│ │ )
│ └── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ ├── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ └── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -396,6 +407,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down Expand Up @@ -691,6 +705,10 @@
│ )
├── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ (
│ │ [System Info]
│ │ Redacted To Not Change The Baselines From Run To Run
│ │ )
│ └── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ ├── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ └── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -799,6 +817,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down Expand Up @@ -976,6 +997,10 @@
│ )
├── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ (
│ │ [System Info]
│ │ Redacted To Not Change The Baselines From Run To Run
│ │ )
│ └── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ ├── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ └── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -1093,6 +1118,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down Expand Up @@ -1301,6 +1329,10 @@
│ )
├── Microsoft.Azure.Cosmos.Handlers.RequestInvokerHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ └── Microsoft.Azure.Cosmos.Handlers.DiagnosticsHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ (
│ │ [System Info]
│ │ Redacted To Not Change The Baselines From Run To Run
│ │ )
│ └── Microsoft.Azure.Cosmos.Handlers.RetryHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ ├── Microsoft.Azure.Cosmos.Handlers.RouterHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
│ │ └── Microsoft.Azure.Cosmos.Handlers.TransportHandler(00000000-0000-0000-0000-000000000000) RequestHandler-Component MemberName@FilePath:42 12:00:00:000 0.00 milliseconds
Expand Down Expand Up @@ -1436,6 +1468,9 @@
"id": "00000000-0000-0000-0000-000000000000",
"start time": "12:00:00:000",
"duration in milliseconds": 0,
"data": {
"System Info": "Redacted To Not Change The Baselines From Run To Run"
},
"children": [
{
"name": "Microsoft.Azure.Cosmos.Handlers.RetryHandler",
Expand Down
Loading

0 comments on commit 5106255

Please sign in to comment.