Skip to content

Commit

Permalink
Fix json property names, update docs & remove parameter modifiers fro…
Browse files Browse the repository at this point in the history
…m the results
  • Loading branch information
clguiman committed Apr 18, 2024
1 parent 3174468 commit 2ad13f6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 101 deletions.
17 changes: 7 additions & 10 deletions documentation/api/definitions.md
Original file line number Diff line number Diff line change
Expand Up @@ -98,10 +98,10 @@ Object describing a captured method and its parameters.
| `activityId` | string | An identifier for the current activity at the time of the capture. For more information see [Activity.Id](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activity.id).|
| `activityIdFormat` | string | The activity Id format. For more information see [Activity.IdFormat](https://learn.microsoft.com/en-us/dotnet/api/system.diagnostics.activity.idformat).|
| `threadId` | int | The managed thread id where the method was called.|
| `dateTime` | DateTime | Time when the method call was captured. |
| `module` | string | The method module name. |
| `type` | string | The method type name. |
| `method` | string | The method name. |
| `timestamp` | DateTime | Time when the method call was captured. |
| `moduleName` | string | The method module name. |
| `typeName` | string | The method type name. |
| `methodName` | string | The method name. |
| `parameters` | [CapturedParameter](#capturedparameter)[] | Array of captured parameters. |

## CapturedParameter
Expand All @@ -112,13 +112,10 @@ Object describing a captured parameter.

| Name | Type | Description |
|---|---|---|
| `name` | string | The parameter name. |
| `parameterName` | string | The parameter name. |
| `value` | string | The parameter value. |
| `type` | string | The parameter type name. |
| `module` | string | The parameter type module name. |
| `isIn` | bool | Whether the parameter has the [`in` modifier](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/method-parameters#in-parameter-modifier). If missing, its value is `false`. |
| `isOut` | bool | Whether the parameter has the [`out` modifier](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/method-parameters#out-parameter-modifier). If missing, its value is `false`. |
| `isByRef` | bool | Whether the parameter has the [`ref` modifier](https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/method-parameters#ref-parameter-modifier). If missing, its value is `false`. |
| `typeName` | string | The parameter type name. |
| `moduleName` | string | The parameter type module name. |

## CaptureParametersConfiguration

Expand Down
61 changes: 5 additions & 56 deletions documentation/api/parameters.md
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ The following logger categories are used inside the target application when capt
POST /parameters?pid=21632&durationSeconds=60 HTTP/1.1
Host: localhost:52323
Authorization: Bearer fffffffffffffffffffffffffffffffffffffffffff=
Accept: application/json
Accept: application/x-ndjson
{
"methods": [
Expand All @@ -112,61 +112,10 @@ Accept: application/json

```http
HTTP/1.1 200 OK
Content-Type: application/json
{
"captures": [
{
"activityId": "00-17657ab99a51e3e46cf5bb3fd583daab-03c903f46b511852-00",
"activityIdFormat": "W3C",
"dateTime": "2024-03-15T14:47:51.2129742-04:00",
"module": "System.Private.CoreLib.dll",
"type": "System.String",
"method": "Concat",
"parameters": [
{
"name": "str0",
"type": "System.String",
"module": "System.Private.CoreLib.dll",
"value": "\u0027localhost\u0027"
},
{
"name": "str1",
"type": "System.String",
"module": "System.Private.CoreLib.dll",
"value": "\u0027:\u0027"
},
{
"name": "str2",
"type": "System.String",
"module": "System.Private.CoreLib.dll",
"value": "\u00277290\u0027"
}
]
},
{
"activityId": "00-9838f17b20cd76c2df3bdaa0fcd716c9-7ce53ae1e886e236-00",
"activityIdFormat": "W3C",
"capturedDateTime": "2024-03-15T14:48:42.5997554-04:00",
"module": "System.Private.CoreLib.dll",
"type": "System.String",
"method": "Concat",
"parameters": [
{
"name": "str0",
"type": "System.String",
"module": "System.Private.CoreLib.dll",
"value": "\u0027\u0027"
},
{
"name": "str1",
"type": "System.String",
"module": "System.Private.CoreLib.dll",
"value": "\u0027/Account/SignIn\u0027"
}
]
}
]
}
Content-Type: application/x-ndjson
{"activityId":"00-aeacc84edb640c5dc72477747729a975-42f991d5c79b02d8-00","activityIdFormat":"W3C","threadId":13,"timestamp":"2024-04-18T08:49:54.1957076-04:00","moduleName":"System.Private.CoreLib.dll","typeName":"System.String","methodName":"Concat","parameters":[{"parameterName":"str0","typeName":"System.String","moduleName":"System.Private.CoreLib.dll","value":"\u0027localhost\u0027"},{"parameterName":"str1","typeName":"System.String","moduleName":"System.Private.CoreLib.dll","value":"\u0027:\u0027"},{"parameterName":"str2","typeName":"System.String","moduleName":"System.Private.CoreLib.dll","value":"\u00277290\u0027"}]}
{"activityId":"00-aeacc84edb640c5dc72477747729a975-42f991d5c79b02d8-00","activityIdFormat":"W3C","threadId":13,"timestamp":"2024-04-18T08:49:54.196018-04:00","moduleName":"System.Private.CoreLib.dll","typeName":"System.String","methodName":"Concat","parameters":[{"parameterName":"str0","typeName":"System.String","moduleName":"System.Private.CoreLib.dll","value":"\u0027\u0027"},{"parameterName":"str1","typeName":"System.String","moduleName":"System.Private.CoreLib.dll","value":"\u0027/Account/SignIn\u0027"}]}
```

## Supported Runtimes
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,17 @@ namespace Microsoft.Diagnostics.Monitoring.WebApi.Models
{
public class CapturedParameter
{
[JsonPropertyName("name")]
[JsonPropertyName("parameterName")]
public string Name { get; set; }

[JsonPropertyName("type")]
[JsonPropertyName("typeName")]
public string Type { get; set; }

[JsonPropertyName("module")]
[JsonPropertyName("moduleName")]
public string TypeModuleName { get; set; }

[JsonPropertyName("value")]
public string Value { get; set; }

[JsonPropertyName("isIn")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool IsInParameter { get; set; }

[JsonPropertyName("isOut")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool IsOutParameter { get; set; }

[JsonPropertyName("isByRef")]
[JsonIgnore(Condition = JsonIgnoreCondition.WhenWritingDefault)]
public bool IsByRefParameter { get; set; }
}

public class CapturedMethod
Expand All @@ -47,16 +35,16 @@ public class CapturedMethod
[JsonPropertyName("threadId")]
public int ThreadId { get; set; }

[JsonPropertyName("dateTime")]
[JsonPropertyName("timestamp")]
public DateTime CapturedDateTime { get; set; }

[JsonPropertyName("module")]
[JsonPropertyName("moduleName")]
public string ModuleName { get; set; }

[JsonPropertyName("type")]
[JsonPropertyName("typeName")]
public string TypeName { get; set; }

[JsonPropertyName("method")]
[JsonPropertyName("methodName")]
public string MethodName { get; set; }

[JsonPropertyName("parameters")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,7 @@ public async Task WriteParameters(ICapturedParameters parameters, CancellationTo
Name = param.Name,
Type = param.Type,
TypeModuleName = param.TypeModuleName,
Value = param.Value,
IsInParameter = param.IsIn,
IsOutParameter = param.IsOut,
IsByRefParameter = param.IsByRef
Value = param.Value
}).ToList()
};
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,6 @@ protected override async Task WriteCapturedMethodAsync(CapturedMethod capture, C
foreach (CapturedParameter parameter in capture.Parameters)
{
builder.Append(FormattableString.Invariant($"{Indent}{Indent}{GetValueOrUnknown(parameter.TypeModuleName)}!{GetValueOrUnknown(parameter.Type)} "));
if (parameter.IsInParameter)
{
builder.Append("in ");
}
else if (parameter.IsOutParameter)
{
builder.Append("out ");
}
else if (parameter.IsByRefParameter)
{
builder.Append("ref ");
}
builder.AppendLine(FormattableString.Invariant($"{GetValueOrUnknown(parameter.Name)}: {GetValueOrUnknown(parameter.Value)}"));
}

Expand Down

0 comments on commit 2ad13f6

Please sign in to comment.