From dc386aaa2056dff89e7d91c089482b66d787cea5 Mon Sep 17 00:00:00 2001 From: Samir Solanki Date: Thu, 30 Jan 2020 14:32:49 -0800 Subject: [PATCH 1/2] Diagnostic Contract update --- .../2019-12-01-preview/definitions.json | 58 ++++++++++++++++++- .../ApiManagementGetApiDiagnostic.json | 33 +++++------ .../examples/ApiManagementGetDiagnostic.json | 32 +++++----- .../ApiManagementListApiDiagnostics.json | 39 +++++-------- .../ApiManagementListDiagnostics.json | 49 +++++++++------- .../stable/2019-01-01/definitions.json | 4 ++ 6 files changed, 131 insertions(+), 84 deletions(-) diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/definitions.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/definitions.json index 0062d56711e3..6689c928a966 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/definitions.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/definitions.json @@ -1784,9 +1784,63 @@ "$ref": "#/definitions/PipelineDiagnosticSettings", "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Backend" }, - "enableHttpCorrelationHeaders": { + "logClientIp": { "type": "boolean", - "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true." + "description": "Log the ClientIP. Default is false." + }, + "httpCorrelationProtocol": { + "type": "string", + "enum": [ + "None", + "Legacy", + "W3C" + ], + "x-ms-enum": { + "name": "HttpCorrelationProtocol", + "modelAsString": true, + "values": [ + { + "value": "None", + "description": "Do not read and inject correlation headers." + }, + { + "value": "Legacy", + "description": "Inject Request-Id and Request-Context headers with request correlation data. See https://github.com/dotnet/corefx/blob/master/src/System.Diagnostics.DiagnosticSource/src/HttpCorrelationProtocol.md." + }, + { + "value": "W3C", + "description": "Inject Trace Context headers. See https://w3c.github.io/trace-context." + } + ] + }, + "description": "Sets correlation protocol to use for Application Insights diagnostics." + }, + "verbosity": { + "type": "string", + "enum": [ + "verbose", + "information", + "error" + ], + "x-ms-enum": { + "name": "Verbosity", + "modelAsString": true, + "values": [ + { + "value": "verbose", + "description": "All the traces emitted by trace policies will be sent to the logger attached to this diagnostic instance." + }, + { + "value": "information", + "description": "Traces with 'severity' set to 'information' and 'error' will be sent to the logger attached to this diagnostic instance." + }, + { + "value": "error", + "description": "Only traces with 'severity' set to 'error' will be sent to the logger attached to this diagnostic instance." + } + ] + }, + "description": "The verbosity level applied to traces emitted by trace policies." } }, "required": [ diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json index d043e6e6784d..304c60246cc7 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json @@ -10,49 +10,44 @@ "responses": { "200": { "body": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/diagnostics/applicationinsights", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics/applicationinsights", "type": "Microsoft.ApiManagement/service/apis/diagnostics", "name": "applicationinsights", "properties": { "alwaysLog": "allErrors", - "loggerId": "/loggers/applicationinsights", + "enableHttpCorrelationHeaders": true, + "httpCorrelationProtocol": "Legacy", + "logClientIp": true, + "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest", "sampling": { "samplingType": "fixed", - "percentage": 50 + "percentage": 100 }, "frontend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } } }, "backend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } } } diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetDiagnostic.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetDiagnostic.json index ca78979093f9..211f54efe1e0 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetDiagnostic.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetDiagnostic.json @@ -9,49 +9,43 @@ "responses": { "200": { "body": { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights", "type": "Microsoft.ApiManagement/service/diagnostics", "name": "applicationinsights", "properties": { "alwaysLog": "allErrors", - "loggerId": "/loggers/applicationinsights", + "httpCorrelationProtocol": "Legacy", + "logClientIp": true, + "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest", "sampling": { "samplingType": "fixed", - "percentage": 50 + "percentage": 100 }, "frontend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } } }, "backend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } } } diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListApiDiagnostics.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListApiDiagnostics.json index ac28012498be..a84a00b7c5f8 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListApiDiagnostics.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListApiDiagnostics.json @@ -4,63 +4,56 @@ "resourceGroupName": "rg1", "api-version": "2019-12-01-preview", "subscriptionId": "subid", - "apiId": "57d1f7558aa04f15146d9d8a" + "apiId": "echo-api" }, "responses": { "200": { "body": { "value": [ { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/57d1f7558aa04f15146d9d8a/diagnostics/applicationinsights", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/echo-api/diagnostics/applicationinsights", "type": "Microsoft.ApiManagement/service/apis/diagnostics", - "name": "default", + "name": "applicationinsights", "properties": { "alwaysLog": "allErrors", - "loggerId": "/loggers/applicationinsights", + "httpCorrelationProtocol": "Legacy", + "logClientIp": true, + "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest", "sampling": { "samplingType": "fixed", - "percentage": 50 + "percentage": 100 }, "frontend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } } }, "backend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 100 } } } } } - ], - "nextLink": "" + ] } } } diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListDiagnostics.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListDiagnostics.json index 24bf7f857493..08381a392189 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListDiagnostics.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementListDiagnostics.json @@ -10,56 +10,63 @@ "body": { "value": [ { - "id": "/subscriptions/subid/resourcegroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights", + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/applicationinsights", "type": "Microsoft.ApiManagement/service/diagnostics", "name": "applicationinsights", "properties": { "alwaysLog": "allErrors", - "loggerId": "/loggers/applicationinsights", + "httpCorrelationProtocol": "Legacy", + "verbosity": "information", + "logClientIp": true, + "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest", "sampling": { "samplingType": "fixed", - "percentage": 50 + "percentage": 100 }, "frontend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 0 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 0 } } }, "backend": { "request": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 0 } }, "response": { - "headers": [ - "Content-type" - ], + "headers": [], "body": { - "bytes": 512 + "bytes": 0 } } } } + }, + { + "id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/diagnostics/azuremonitor", + "type": "Microsoft.ApiManagement/service/diagnostics", + "name": "azuremonitor", + "properties": { + "logClientIp": true, + "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/azuremonitor", + "sampling": { + "samplingType": "fixed", + "percentage": 100 + } + } } - ], - "nextLink": "" + ] } } } diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json index 6943dc4272a7..950a85aa7595 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/stable/2019-01-01/definitions.json @@ -1784,6 +1784,10 @@ "$ref": "#/definitions/PipelineDiagnosticSettings", "description": "Diagnostic settings for incoming/outgoing HTTP messages to the Backend" }, + "enableHttpCorrelationHeaders": { + "type": "boolean", + "description": "Whether to process Correlation Headers coming to Api Management Service. Only applicable to Application Insights diagnostics. Default is true." + }, "httpCorrelationProtocol": { "type": "string", "enum": [ From 65d9c1dc98c2942aac1d2e12e25c33a89e18504c Mon Sep 17 00:00:00 2001 From: Samir Solanki Date: Fri, 31 Jan 2020 16:49:41 -0800 Subject: [PATCH 2/2] there is no enableHttpCorrelation in 2019-12-01-preview --- .../examples/ApiManagementGetApiDiagnostic.json | 1 - 1 file changed, 1 deletion(-) diff --git a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json index 304c60246cc7..7b716a1e435d 100644 --- a/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json +++ b/specification/apimanagement/resource-manager/Microsoft.ApiManagement/preview/2019-12-01-preview/examples/ApiManagementGetApiDiagnostic.json @@ -15,7 +15,6 @@ "name": "applicationinsights", "properties": { "alwaysLog": "allErrors", - "enableHttpCorrelationHeaders": true, "httpCorrelationProtocol": "Legacy", "logClientIp": true, "loggerId": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/loggers/aisamplingtest",