From 6e1d287f599112bd4c573b00cb65bb4c1ee1a712 Mon Sep 17 00:00:00 2001 From: Paul Van Eck Date: Fri, 14 Nov 2025 02:22:58 +0000 Subject: [PATCH] [Monitor] Add Monitor Exporter TypeSpec Signed-off-by: Paul Van Eck --- .../client.tsp | 23 + .../examples/v2.1/track.json | 190 +++ .../main.tsp | 31 + .../models.tsp | 816 ++++++++++ .../routes.tsp | 41 + .../tspconfig.yaml | 46 + .../preview/v2.1/examples/track.json | 9 +- .../preview/v2.1/swagger.json | 1321 ++++++++--------- .../applicationinsights/suppressions.yaml | 7 + 9 files changed, 1768 insertions(+), 716 deletions(-) create mode 100644 specification/applicationinsights/ApplicationInsights.Monitor.Exporters/client.tsp create mode 100644 specification/applicationinsights/ApplicationInsights.Monitor.Exporters/examples/v2.1/track.json create mode 100644 specification/applicationinsights/ApplicationInsights.Monitor.Exporters/main.tsp create mode 100644 specification/applicationinsights/ApplicationInsights.Monitor.Exporters/models.tsp create mode 100644 specification/applicationinsights/ApplicationInsights.Monitor.Exporters/routes.tsp create mode 100644 specification/applicationinsights/ApplicationInsights.Monitor.Exporters/tspconfig.yaml create mode 100644 specification/applicationinsights/suppressions.yaml diff --git a/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/client.tsp b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/client.tsp new file mode 100644 index 000000000000..cf52cecf8b94 --- /dev/null +++ b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/client.tsp @@ -0,0 +1,23 @@ +import "./main.tsp"; +import "@azure-tools/typespec-client-generator-core"; + +using Azure.ClientGenerator.Core; +using AzureMonitorExporter; + +@@clientName(Base, "MonitorBase"); +@@clientName(Domain, "EventDomain"); +@@clientName(EventData, "TelemetryEventData"); +@@clientName(DataPoint, "MetricDataPoint"); +@@clientName(ExceptionData, "TelemetryExceptionData"); +@@clientName(ExceptionDetails, "TelemetryExceptionDetails"); +@@clientName(ErrorDetails, "TelemetryErrorDetails"); +@@clientName(TelemetryEnvelope, "TelemetryItem"); + +@@clientName(TelemetryEnvelope.ver, "version"); +@@clientName(TelemetryEnvelope.seq, "sequence"); +@@clientName(TelemetryEnvelope.iKey, "instrumentationKey"); + +@@clientName(Domain.ver, "version"); + +@@clientName(DataPoint.ns, "namespace"); +@@clientName(DataPoint.kind, "dataPointType"); diff --git a/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/examples/v2.1/track.json b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/examples/v2.1/track.json new file mode 100644 index 000000000000..bfc8eb50f567 --- /dev/null +++ b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/examples/v2.1/track.json @@ -0,0 +1,190 @@ +{ + "operationId": "Track", + "title": "Send telemetry data", + "description": "This is a request sending telemetry data to Azure Monitor.", + "parameters": { + "body": [ + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + }, + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + }, + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + }, + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + }, + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + }, + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + }, + { + "ver": 1, + "name": "Microsoft.ApplicationInsights.b4f83947968d4e2f82ad804be07697ae.Event", + "time": "2020-09-22T10:12:53.208-0700", + "sampleRate": 100.0, + "iKey": "c1f83947-938c-5e2a-82ff-804be07647bc", + "tags": { + "ai.internal.sdkVersion": "java:3.0.0-PREVIEW.5", + "ai.internal.nodeName": "MININT-PLOJ2RD", + "ai.operation.id": "f364119ed1ff3bcda0d4ee0896cf785f", + "ai.cloud.roleInstance": "MININT-PLOJ2RD", + "ai.operation.childid": "75706a2ac9456288" + } + } + ] + }, + "responses": { + "200": { + "headers": {}, + "body": { + "itemsReceived": 1, + "itemsAccepted": 1, + "errors": [] + } + }, + "206": { + "headers": {}, + "body": { + "itemsReceived": 1, + "itemsAccepted": 1, + "errors": [] + } + }, + "400": { + "body": { + "itemsReceived": 1, + "itemsAccepted": 0, + "errors": [ + { + "index": 1, + "statusCode": 400, + "message": "103: Field 'time' on type 'Envelope' is older than the allowed min date. Expected: now - 172800000ms, Actual: now - 2694990759ms" + } + ] + } + }, + "402": { + "body": { + "itemsReceived": 1, + "itemsAccepted": 0, + "errors": [ + { + "index": 1, + "statusCode": 402, + "message": "" + } + ] + } + }, + "429": { + "body": { + "itemsReceived": 1, + "itemsAccepted": 0, + "errors": [ + { + "index": 1, + "statusCode": 429, + "message": "" + } + ] + } + }, + "500": { + "body": { + "itemsReceived": 1, + "itemsAccepted": 0, + "errors": [ + { + "index": 1, + "statusCode": 500, + "message": "" + } + ] + } + }, + "503": { + "body": { + "itemsReceived": 1, + "itemsAccepted": 0, + "errors": [ + { + "index": 1, + "statusCode": 503, + "message": "" + } + ] + } + } + } +} diff --git a/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/main.tsp b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/main.tsp new file mode 100644 index 000000000000..d2d7bf98badb --- /dev/null +++ b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/main.tsp @@ -0,0 +1,31 @@ +import "@typespec/rest"; +import "@typespec/http"; +import "./routes.tsp"; + +using TypeSpec.Http; +using TypeSpec.Versioning; + +/** + * OpenTelemetry Exporter for Azure Monitor + */ +#suppress "@azure-tools/typespec-autorest/unsupported-auth" "NoAuth is supported" +@useAuth(NoAuth) +@service(#{ title: "Azure Monitor Exporter" }) +@versioned(Versions) +@server( + "{host}/{apiVersion}", + "Azure Monitor Logs Query Service", + { + /** Application Insights' Breeze endpoint. */ + host: url = "https://dc.services.visualstudio.com", + + /** The service API version. */ + apiVersion: Versions, + } +) +namespace AzureMonitorExporter; + +enum Versions { + /** The V2.1 API version. */ + V2_1: "v2.1", +} diff --git a/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/models.tsp b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/models.tsp new file mode 100644 index 000000000000..2d6aafadc7de --- /dev/null +++ b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/models.tsp @@ -0,0 +1,816 @@ +namespace AzureMonitorExporter; + +using TypeSpec.Http; + +/** + * Type of the metric data. + */ +union DataPointType { + string, + + /** Single measurement. */ + Measurement: "Measurement", + + /** Aggregated value. */ + Aggregation: "Aggregation", +} + +/** + * Defines the level of severity for the event. + */ +union SeverityLevel { + string, + + /** Verbose level. */ + Verbose: "Verbose", + + /** Information level. */ + Information: "Information", + + /** Warning level. */ + Warning: "Warning", + + /** Error level. */ + Error: "Error", + + /** Critical level. */ + Critical: "Critical", +} + +/** + * The context tag keys. + */ +union ContextTagKeys { + string, + + /** Application version. */ + AiApplicationVer: "ai.application.ver", + + /** Device ID. */ + AiDeviceId: "ai.device.id", + + /** Device locale. */ + AiDeviceLocale: "ai.device.locale", + + /** Device model. */ + AiDeviceModel: "ai.device.model", + + /** Device OEM name. */ + AiDeviceOemName: "ai.device.oemName", + + /** Device OS version. */ + AiDeviceOSVersion: "ai.device.osVersion", + + /** Device type. */ + AiDeviceType: "ai.device.type", + + /** Location IP. */ + AiLocationIp: "ai.location.ip", + + /** Location country. */ + AiLocationCountry: "ai.location.country", + + /** Location province. */ + AiLocationProvince: "ai.location.province", + + /** Location city. */ + AiLocationCity: "ai.location.city", + + /** Operation ID. */ + AiOperationId: "ai.operation.id", + + /** Operation name. */ + AiOperationName: "ai.operation.name", + + /** Operation parent ID. */ + AiOperationParentId: "ai.operation.parentId", + + /** Operation synthetic source. */ + AiOperationSyntheticSource: "ai.operation.syntheticSource", + + /** Operation correlation vector. */ + AiOperationCorrelationVector: "ai.operation.correlationVector", + + /** Session ID. */ + AiSessionId: "ai.session.id", + + /** If session is the first one. */ + AiSessionIsFirst: "ai.session.isFirst", + + /** User account ID. */ + AiUserAccountId: "ai.user.accountId", + + /** User ID. */ + AiUserId: "ai.user.id", + + /** Authenticated user ID. */ + AiUserAuthUserId: "ai.user.authUserId", + + /** Cloud role. */ + AiCloudRole: "ai.cloud.role", + + /** Cloud role version. */ + AiCloudRoleVer: "ai.cloud.roleVer", + + /** Cloud role instance. */ + AiCloudRoleInstance: "ai.cloud.roleInstance", + + /** Cloud location. */ + AiCloudLocation: "ai.cloud.location", + + /** Internal SDK version. */ + AiInternalSdkVersion: "ai.internal.sdkVersion", + + /** Internal agent version. */ + AiInternalAgentVersion: "ai.internal.agentVersion", + + /** Internal node name. */ + AiInternalNodeName: "ai.internal.nodeName", +} + +/** + * System variables for a telemetry item. + */ +model TelemetryEnvelope { + /** + * Envelope version. For internal use only. By assigning this the default, it will + * not be serialized within the payload unless changed to a value other than #1. + */ + ver?: int32 = 1; + + /** + * Type name of telemetry data item. + */ + name: string; + + /** + * Event date time when telemetry item was created. This is the wall clock time on + * the client when the event was generated. There is no guarantee that the + * client's time is accurate. This field must be formatted in UTC ISO 8601 format, + * with a trailing 'Z' character, as described publicly on + * https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds + * digits provided are variable (and unspecified). Consumers should handle this, + * i.e. managed code consumers should not use format 'O' for parsing as it + * specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z. + */ + // FIXME: (utcDateTime) Please double check that this is the correct type for your scenario. + time: utcDateTime; + + /** + * Sampling rate used in application. This telemetry item represents 100 / + * sampleRate actual telemetry items. + */ + sampleRate?: float32 = 100; + + /** + * Sequence field used to track absolute order of uploaded events. + */ + @maxLength(64) + seq?: string; + + /** + * The instrumentation key of the Application Insights resource. + */ + iKey?: string; + + /** + * Key/value collection of context properties. See ContextTagKeys for information + * on available properties. + */ + tags?: Record; + + /** + * Telemetry data item. + */ + data?: Base; +} + +/** + * Data struct to contain only C section with custom fields. + */ +model Base { + /** + * Name of item (B section) if any. If telemetry data is derived straight from + * this, this should be null. + */ + baseType?: string; + + /** + * The data payload for the telemetry request + */ + #suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" + baseData?: Domain; +} + +/** + * The abstract common base of all domains. + */ +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model Domain { + ...Record; + + /** + * Schema version + */ + ver: int32 = 2; +} + +/** + * Response containing the status of each telemetry item. + */ +model TrackResponse { + /** + * The number of items received. + */ + itemsReceived?: int32; + + /** + * The number of items accepted. + */ + itemsAccepted?: int32; + + /** + * An array of error detail objects. + */ + errors?: ErrorDetails[]; +} +/** + * Error response containing the status of each telemetry item. + */ +@error +model TrackResponseError { + /** Error status codes. */ + #suppress "@azure-tools/typespec-azure-core/no-closed-literal-union" "Allows these specific status codes" + @statusCode + statusCode: 400 | 402 | 429 | 500 | 503; + + /** + * Response containing the status of each telemetry item. + */ + @body + body: TrackResponse; +} +/** + * The error details + */ +model ErrorDetails { + /** + * The index in the original payload of the item. + */ + index?: int32; + + /** + * The item specific [HTTP Response status code](#Response Status Codes). + */ + statusCode?: int32; + + /** + * The error message. + */ + message?: string; +} + +/** + * Instances of AvailabilityData represent the result of executing an availability + * test. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model AvailabilityData extends Domain { + /** + * Identifier of a test run. Use it to correlate steps of test run and telemetry + * generated by the service. + */ + @maxLength(512) + id: string; + + /** + * Name of the test that these availability results represent. + */ + @maxLength(1024) + name: string; + + /** + * Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. + */ + duration: string; + + /** + * Success flag. + */ + success: boolean; + + /** + * Name of the location where the test was run from. + */ + @maxLength(1024) + runLocation?: string; + + /** + * Diagnostic message for the result. + */ + @maxLength(8192) + message?: string; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * Metric data single measurement. + */ +model DataPoint { + /** + * Namespace of the metric. + */ + @maxLength(256) + ns?: string; + + /** + * Name of the metric. + */ + @maxLength(1024) + name: string; + + /** + * Metric type. Single measurement or the aggregated value. + */ + kind?: DataPointType; + + /** + * Single value for measurement. Sum of individual measurements for the + * aggregation. + */ + value: float64; + + /** + * Metric weight of the aggregated metric. Should not be set for a measurement. + */ + count?: int32; + + /** + * Minimum value of the aggregated metric. Should not be set for a measurement. + */ + min?: float64; + + /** + * Maximum value of the aggregated metric. Should not be set for a measurement. + */ + max?: float64; + + /** + * Standard deviation of the aggregated metric. Should not be set for a + * measurement. + */ + stdDev?: float64; +} + +/** + * Instances of Event represent structured event records that can be grouped and + * searched by their properties. Event data item also creates a metric of event + * count by name. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model EventData extends Domain { + /** + * Event name. Keep it low cardinality to allow proper grouping and useful metrics. + */ + @maxLength(512) + name: string; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * An instance of Exception represents a handled or unhandled exception that + * occurred during execution of the monitored application. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model ExceptionData extends Domain { + /** + * Exception chain - list of inner exceptions. + */ + exceptions: ExceptionDetails[]; + + /** + * Severity level. Mostly used to indicate exception severity level when it is + * reported by logging library. + */ + severityLevel?: SeverityLevel; + + /** + * Identifier of where the exception was thrown in code. Used for exceptions + * grouping. Typically a combination of exception type and a function from the + * call stack. + */ + @maxLength(1024) + problemId?: string; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * Exception details of the exception in a chain. + */ +model ExceptionDetails { + /** + * In case exception is nested (outer exception contains inner one), the id and + * outerId properties are used to represent the nesting. + */ + id?: int32; + + /** + * The value of outerId is a reference to an element in ExceptionDetails that + * represents the outer exception + */ + outerId?: int32; + + /** + * Exception type name. + */ + @maxLength(1024) + typeName?: string; + + /** + * Exception message. + */ + @maxLength(32768) + message: string; + + /** + * Indicates if full exception stack is provided in the exception. The stack may + * be trimmed, such as in the case of a StackOverflow exception. + */ + hasFullStack?: boolean = true; + + /** + * Text describing the stack. Either stack or parsedStack should have a value. + */ + @maxLength(32768) + stack?: string; + + /** + * List of stack frames. Either stack or parsedStack should have a value. + */ + parsedStack?: StackFrame[]; +} + +/** + * Stack frame information. + */ +model StackFrame { + /** Level in the stack. */ + level: int32; + + /** + * Method name. + */ + @maxLength(1024) + method: string; + + /** + * Name of the assembly (dll, jar, etc.) containing this function. + */ + @maxLength(1024) + assembly?: string; + + /** + * File name or URL of the method implementation. + */ + @maxLength(1024) + fileName?: string; + + /** + * Line number of the code implementation. + */ + line?: int32; +} + +/** + * Instances of Message represent printf-like trace statements that are + * text-searched. Log4Net, NLog and other text-based log file entries are + * translated into instances of this type. The message does not have measurements. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model MessageData extends Domain { + /** + * Trace message + */ + @maxLength(32768) + message: string; + + /** + * Trace severity level. + */ + severityLevel?: SeverityLevel; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * An instance of the Metric item is a list of measurements (single data points) + * and/or aggregations. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model MetricsData extends Domain { + /** + * List of metrics. Only one metric in the list is currently supported by + * Application Insights storage. If multiple data points were sent only the first + * one will be used. + */ + metrics: DataPoint[]; + + /** + * Collection of custom properties. + */ + properties?: Record; +} + +/** + * An instance of PageView represents a generic action on a page like a button + * click. It is also the base type for PageView. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model PageViewData extends Domain { + /** + * Identifier of a page view instance. Used for correlation between page view and + * other telemetry items. + */ + @maxLength(512) + id: string; + + /** + * Event name. Keep it low cardinality to allow proper grouping and useful metrics. + */ + @maxLength(1024) + name: string; + + /** + * Request URL with all query string parameters + */ + @maxLength(2048) + url?: string; + + /** + * Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), + * this is the duration. For a page view with performance information + * (PageViewPerfData), this is the page load time. Must be less than 1000 days. + */ + duration?: string; + + /** + * Fully qualified page URI or URL of the referring page; if unknown, leave blank + */ + @maxLength(2048) + referredUri?: string; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * An instance of PageViewPerf represents: a page view with no performance data, a + * page view with performance data, or just the performance data of an earlier + * page request. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model PageViewPerfData extends Domain { + /** + * Identifier of a page view instance. Used for correlation between page view and + * other telemetry items. + */ + @maxLength(512) + id: string; + + /** + * Event name. Keep it low cardinality to allow proper grouping and useful metrics. + */ + @maxLength(1024) + name: string; + + /** + * Request URL with all query string parameters + */ + @maxLength(2048) + url?: string; + + /** + * Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), + * this is the duration. For a page view with performance information + * (PageViewPerfData), this is the page load time. Must be less than 1000 days. + */ + duration?: string; + + /** + * Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff + */ + perfTotal?: string; + + /** + * Network connection time in TimeSpan 'G' (general long) format: + * d:hh:mm:ss.fffffff + */ + networkConnect?: string; + + /** + * Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff + */ + sentRequest?: string; + + /** + * Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff + */ + receivedResponse?: string; + + /** + * DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff + */ + domProcessing?: string; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * An instance of Remote Dependency represents an interaction of the monitored + * component with a remote component/service like SQL or an HTTP endpoint. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model RemoteDependencyData extends Domain { + /** + * Identifier of a dependency call instance. Used for correlation with the request + * telemetry item corresponding to this dependency call. + */ + @maxLength(512) + id?: string; + + /** + * Name of the command initiated with this dependency call. Low cardinality value. + * Examples are stored procedure name and URL path template. + */ + @maxLength(1024) + name: string; + + /** + * Result code of a dependency call. Examples are SQL error code and HTTP status + * code. + */ + @maxLength(1024) + resultCode?: string; + + /** + * Command initiated by this dependency call. Examples are SQL statement and HTTP + * URL with all query parameters. + */ + @maxLength(8192) + data?: string; + + /** + * Dependency type name. Very low cardinality value for logical grouping of + * dependencies and interpretation of other fields like commandName and + * resultCode. Examples are SQL, Azure table, and HTTP. + */ + @maxLength(1024) + type?: string; + + /** + * Target site of a dependency call. Examples are server name, host address. + */ + @maxLength(1024) + target?: string; + + /** + * Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. + */ + duration: string; + + /** + * Indication of successful or unsuccessful call. + */ + success?: boolean = true; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} + +/** + * An instance of Request represents completion of an external request to the + * application to do work and contains a summary of that request execution and the + * results. + */ +#suppress "@azure-tools/typespec-azure-core/composition-over-inheritance" "For backward compatibility" +#suppress "@azure-tools/typespec-azure-core/bad-record-type" "For backward compatibility" +model RequestData extends Domain { + /** + * Identifier of a request call instance. Used for correlation between request and + * other telemetry items. + */ + @maxLength(512) + id: string; + + /** + * Name of the request. Represents code path taken to process request. Low + * cardinality value to allow better grouping of requests. For HTTP requests it + * represents the HTTP method and URL path template like 'GET /values/{id}'. + */ + @maxLength(1024) + name?: string; + + /** + * Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days. + */ + duration: string; + + /** + * Indication of successful or unsuccessful call. + */ + success: boolean = true; + + /** + * Result of a request execution. HTTP status code for HTTP requests. + */ + @maxLength(1024) + responseCode: string; + + /** + * Source of the request. Examples are the instrumentation key of the caller or + * the ip address of the caller. + */ + @maxLength(1024) + source?: string; + + /** + * Request URL with all query string parameters. + */ + @maxLength(2048) + url?: string; + + /** + * Collection of custom properties. + */ + properties?: Record; + + /** + * Collection of custom measurements. + */ + measurements?: Record; +} diff --git a/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/routes.tsp b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/routes.tsp new file mode 100644 index 000000000000..c1b66eda09ad --- /dev/null +++ b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/routes.tsp @@ -0,0 +1,41 @@ +import "@azure-tools/typespec-azure-core"; +import "@typespec/rest"; +import "./models.tsp"; + +using TypeSpec.Http; + +namespace AzureMonitorExporter; + +/** + * This operation sends a sequence of telemetry events that will be monitored by + * Azure Monitor. + */ +#suppress "@azure-tools/typespec-azure-core/use-standard-operations" "Doesn't fit standard ops" +#suppress "@azure-tools/typespec-azure-core/operation-missing-api-version" "This service uses path param to specify API version" +@summary("Track telemetry events") +@route("/track") +@post +op track( + /** + * The list of telemetry events to track. + */ + #suppress "@azure-tools/typespec-azure-core/request-body-problem" "Raw array type used for backward compatibility" + @bodyRoot + body: TelemetryEnvelope[], + + /** + * Body Parameter content-type + */ + @header("content-type") + contentType: "application/json", +): { + /** All of the telemetry items were accepted and processed. */ + @statusCode statusCode: 200; + + @body body: TrackResponse; +} | { + /** Partial success. Some of the telemetry items were accepted and processed. */ + @statusCode statusCode: 206; + + @body body: TrackResponse; +} | TrackResponseError; diff --git a/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/tspconfig.yaml b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/tspconfig.yaml new file mode 100644 index 000000000000..3168270813b5 --- /dev/null +++ b/specification/applicationinsights/ApplicationInsights.Monitor.Exporters/tspconfig.yaml @@ -0,0 +1,46 @@ +parameters: + "service-dir": + default: "sdk/monitor" + "dependencies": + default: "" + +emit: + - "@azure-tools/typespec-autorest" + +linter: + extends: + - "@azure-tools/typespec-azure-rulesets/data-plane" + +options: + "@azure-tools/typespec-autorest": + azure-resource-provider-folder: "data-plane" + emitter-output-dir: "{project-root}/.." + output-file: "{azure-resource-provider-folder}/Monitor.Exporters/preview/{version}/swagger.json" + omit-unreachable-types: true + "@azure-tools/typespec-python": + emitter-output-dir: "{output-dir}/{service-dir}/azure-monitor-opentelemetry-exporter" + package-name: "azure-monitor-opentelemetry-exporter" + package-mode: dataplane + flavor: azure + namespace: azure.monitor.opentelemetry.exporter._generated + "@azure-tools/typespec-csharp": + namespace: "Azure.Monitor.OpenTelemetry.Exporter" + generate-convenience-methods: false + model-namespace: false + flavor: azure + emitter-output-dir: "{output-dir}/{service-dir}/{namespace}" + output-path: "./src/Generated" + clear-output-folder: true + "@azure-tools/typespec-ts": + emitter-output-dir: "{output-dir}/{service-dir}/monitor-opentelemetry-exporter" + src-folder: "src/generated" + generate-metadata: true + is-modular-library: true + package-details: + name: "@azure/monitor-opentelemetry-exporter" + description: "Azure Monitor OpenTelemetry Exporter" + flavor: azure + "@azure-tools/typespec-java": + emitter-output-dir: "{output-dir}/{service-dir}/azure-monitor-opentelemetry-exporter" + namespace: "com.azure.monitor.opentelemetry.exporter" + flavor: azure diff --git a/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/examples/track.json b/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/examples/track.json index dad4cd1bc839..bfc8eb50f567 100644 --- a/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/examples/track.json +++ b/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/examples/track.json @@ -1,6 +1,8 @@ { + "operationId": "Track", + "title": "Send telemetry data", + "description": "This is a request sending telemetry data to Azure Monitor.", "parameters": { - "Host": "{Host}", "body": [ { "ver": 1, @@ -120,7 +122,6 @@ } }, "400": { - "headers": {}, "body": { "itemsReceived": 1, "itemsAccepted": 0, @@ -134,7 +135,6 @@ } }, "402": { - "headers": {}, "body": { "itemsReceived": 1, "itemsAccepted": 0, @@ -148,7 +148,6 @@ } }, "429": { - "headers": {}, "body": { "itemsReceived": 1, "itemsAccepted": 0, @@ -162,7 +161,6 @@ } }, "500": { - "headers": {}, "body": { "itemsReceived": 1, "itemsAccepted": 0, @@ -176,7 +174,6 @@ } }, "503": { - "headers": {}, "body": { "itemsReceived": 1, "itemsAccepted": 0, diff --git a/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/swagger.json b/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/swagger.json index e87c94887062..dd2e747a4656 100644 --- a/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/swagger.json +++ b/specification/applicationinsights/data-plane/Monitor.Exporters/preview/v2.1/swagger.json @@ -1,25 +1,68 @@ { "swagger": "2.0", "info": { + "title": "Azure Monitor Exporter", "version": "v2.1", - "title": "ApplicationInsightsClient", - "description": "This document describes the protocol for client requests and responses to the data collection endpoint." + "description": "OpenTelemetry Exporter for Azure Monitor", + "x-typespec-generated": [ + { + "emitter": "@azure-tools/typespec-autorest" + } + ] }, + "schemes": [ + "https" + ], "x-ms-parameterized-host": { - "hostTemplate": "{Host}/v2.1", + "hostTemplate": "{host}/{apiVersion}", "useSchemePrefix": false, "parameters": [ { - "$ref": "#/parameters/Host" + "name": "host", + "in": "path", + "description": "Application Insights' Breeze endpoint.", + "required": true, + "type": "string", + "format": "uri", + "default": "https://dc.services.visualstudio.com", + "x-ms-skip-url-encoding": true + }, + { + "name": "apiVersion", + "in": "path", + "description": "The service API version.", + "required": true, + "type": "string", + "enum": [ + "v2.1" + ], + "x-ms-enum": { + "name": "Versions", + "modelAsString": true, + "values": [ + { + "name": "V2_1", + "value": "v2.1", + "description": "The V2.1 API version." + } + ] + } } ] }, + "produces": [ + "application/json" + ], + "consumes": [ + "application/json" + ], + "tags": [], "paths": { "/track": { "post": { + "operationId": "Track", "summary": "Track telemetry events", - "description": "This operation sends a sequence of telemetry events that will be monitored by Azure Monitor.", - "operationId": "track", + "description": "This operation sends a sequence of telemetry events that will be monitored by\nAzure Monitor.", "parameters": [ { "name": "body", @@ -34,65 +77,58 @@ } } ], - "consumes": [ - "application/json", - "x-json-stream" - ], - "produces": [ - "application/json" - ], "responses": { "200": { - "description": "All of the telemetry items were accepted and processed.", + "description": "The request has succeeded.", "schema": { "$ref": "#/definitions/TrackResponse" } }, "206": { - "description": "Partial success. Some of the telemetry items were accepted and processed.", + "description": "Successful", "schema": { "$ref": "#/definitions/TrackResponse" } }, "400": { - "description": "Bad Request", - "x-ms-error-response": true, + "description": "Error response containing the status of each telemetry item.", "schema": { "$ref": "#/definitions/TrackResponse" - } + }, + "x-ms-error-response": true }, "402": { - "description": "Payment Required", - "x-ms-error-response": true, + "description": "Error response containing the status of each telemetry item.", "schema": { "$ref": "#/definitions/TrackResponse" - } + }, + "x-ms-error-response": true }, "429": { - "description": "Too Many Requests", - "x-ms-error-response": true, + "description": "Error response containing the status of each telemetry item.", "schema": { "$ref": "#/definitions/TrackResponse" - } + }, + "x-ms-error-response": true }, "500": { - "description": "Internal Server Error", - "x-ms-error-response": true, + "description": "Error response containing the status of each telemetry item.", "schema": { "$ref": "#/definitions/TrackResponse" - } + }, + "x-ms-error-response": true }, "503": { - "description": "Service Unavailable", - "x-ms-error-response": true, + "description": "Error response containing the status of each telemetry item.", "schema": { "$ref": "#/definitions/TrackResponse" - } + }, + "x-ms-error-response": true } }, "x-ms-examples": { - "Track examples": { - "$ref": "examples/track.json" + "Send telemetry data": { + "$ref": "./examples/track.json" } } } @@ -100,77 +136,72 @@ }, "definitions": { "AvailabilityData": { - "allOf": [ - { - "$ref": "#/definitions/Domain" + "type": "object", + "description": "Instances of AvailabilityData represent the result of executing an availability\ntest.", + "properties": { + "id": { + "type": "string", + "description": "Identifier of a test run. Use it to correlate steps of test run and telemetry\ngenerated by the service.", + "maxLength": 512 }, - { + "name": { + "type": "string", + "description": "Name of the test that these availability results represent.", + "maxLength": 1024 + }, + "duration": { + "type": "string", + "description": "Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days." + }, + "success": { + "type": "boolean", + "description": "Success flag." + }, + "runLocation": { + "type": "string", + "description": "Name of the location where the test was run from.", + "maxLength": 1024 + }, + "message": { + "type": "string", + "description": "Diagnostic message for the result.", + "maxLength": 8192 + }, + "properties": { "type": "object", - "description": "Instances of AvailabilityData represent the result of executing an availability test.", - "required": [ - "id", - "name", - "duration", - "success" - ], - "properties": { - "id": { - "type": "string", - "description": "Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service.", - "maxLength": 512 - }, - "name": { - "type": "string", - "description": "Name of the test that these availability results represent.", - "maxLength": 1024 - }, - "duration": { - "type": "string", - "description": "Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days." - }, - "success": { - "type": "boolean", - "x-nullable": false, - "description": "Success flag." - }, - "runLocation": { - "type": "string", - "description": "Name of the location where the test was run from.", - "maxLength": 1024 - }, - "message": { - "type": "string", - "description": "Diagnostic message for the result.", - "maxLength": 8192 - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" + } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" } } + }, + "required": [ + "id", + "name", + "duration", + "success" + ], + "allOf": [ + { + "$ref": "#/definitions/Domain" + } ] }, "Base": { - "x-ms-client-name": "MonitorBase", "type": "object", "description": "Data struct to contain only C section with custom fields.", "properties": { "baseType": { "type": "string", - "description": "Name of item (B section) if any. If telemetry data is derived straight from this, this should be null." + "description": "Name of item (B section) if any. If telemetry data is derived straight from\nthis, this should be null." }, "baseData": { "$ref": "#/definitions/Domain", @@ -179,16 +210,10 @@ } }, "DataPoint": { - "x-ms-client-name": "MetricDataPoint", "type": "object", "description": "Metric data single measurement.", - "required": [ - "name", - "value" - ], "properties": { "ns": { - "x-ms-client-name": "namespace", "type": "string", "description": "Namespace of the metric.", "maxLength": 256 @@ -199,172 +224,192 @@ "maxLength": 1024 }, "kind": { - "x-ms-client-name": "dataPointType", "$ref": "#/definitions/DataPointType", "description": "Metric type. Single measurement or the aggregated value." }, "value": { "type": "number", - "description": "Single value for measurement. Sum of individual measurements for the aggregation.", - "format": "double" + "format": "double", + "description": "Single value for measurement. Sum of individual measurements for the\naggregation." }, "count": { - "type": "number", + "type": "integer", "format": "int32", - "description": "Metric weight of the aggregated metric. Should not be set for a measurement.", - "x-nullable": true + "description": "Metric weight of the aggregated metric. Should not be set for a measurement." }, "min": { "type": "number", "format": "double", - "description": "Minimum value of the aggregated metric. Should not be set for a measurement.", - "x-nullable": true + "description": "Minimum value of the aggregated metric. Should not be set for a measurement." }, "max": { "type": "number", "format": "double", - "description": "Maximum value of the aggregated metric. Should not be set for a measurement.", - "x-nullable": true + "description": "Maximum value of the aggregated metric. Should not be set for a measurement." }, "stdDev": { "type": "number", "format": "double", - "description": "Standard deviation of the aggregated metric. Should not be set for a measurement.", - "x-nullable": true + "description": "Standard deviation of the aggregated metric. Should not be set for a\nmeasurement." } - } + }, + "required": [ + "name", + "value" + ] }, "DataPointType": { "type": "string", - "description": "Type of the metric data measurement.", + "description": "Type of the metric data.", "enum": [ "Measurement", "Aggregation" - ] + ], + "x-ms-enum": { + "name": "DataPointType", + "modelAsString": true, + "values": [ + { + "name": "Measurement", + "value": "Measurement", + "description": "Single measurement." + }, + { + "name": "Aggregation", + "value": "Aggregation", + "description": "Aggregated value." + } + ] + } }, "Domain": { - "x-ms-client-name": "MonitorDomain", "type": "object", "description": "The abstract common base of all domains.", - "required": [ - "ver" - ], - "additionalProperties": true, "properties": { "ver": { - "x-ms-client-name": "version", "type": "integer", "format": "int32", "description": "Schema version", "default": 2 } + }, + "required": [ + "ver" + ], + "additionalProperties": {} + }, + "ErrorDetails": { + "type": "object", + "description": "The error details", + "properties": { + "index": { + "type": "integer", + "format": "int32", + "description": "The index in the original payload of the item." + }, + "statusCode": { + "type": "integer", + "format": "int32", + "description": "The item specific [HTTP Response status code](#Response Status Codes)." + }, + "message": { + "type": "string", + "description": "The error message." + } } }, "EventData": { - "x-ms-client-name": "TelemetryEventData", - "allOf": [ - { - "$ref": "#/definitions/Domain" + "type": "object", + "description": "Instances of Event represent structured event records that can be grouped and\nsearched by their properties. Event data item also creates a metric of event\ncount by name.", + "properties": { + "name": { + "type": "string", + "description": "Event name. Keep it low cardinality to allow proper grouping and useful metrics.", + "maxLength": 512 }, - { + "properties": { "type": "object", - "description": "Instances of Event represent structured event records that can be grouped and searched by their properties. Event data item also creates a metric of event count by name.", - "required": [ - "name" - ], - "properties": { - "name": { - "type": "string", - "description": "Event name. Keep it low cardinality to allow proper grouping and useful metrics.", - "maxLength": 512 - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" + } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" } } - ] - }, - "ExceptionData": { - "x-ms-client-name": "TelemetryExceptionData", + }, + "required": [ + "name" + ], "allOf": [ { "$ref": "#/definitions/Domain" + } + ] + }, + "ExceptionData": { + "type": "object", + "description": "An instance of Exception represents a handled or unhandled exception that\noccurred during execution of the monitored application.", + "properties": { + "exceptions": { + "type": "array", + "description": "Exception chain - list of inner exceptions.", + "items": { + "$ref": "#/definitions/ExceptionDetails" + } }, - { + "severityLevel": { + "$ref": "#/definitions/SeverityLevel", + "description": "Severity level. Mostly used to indicate exception severity level when it is\nreported by logging library." + }, + "problemId": { + "type": "string", + "description": "Identifier of where the exception was thrown in code. Used for exceptions\ngrouping. Typically a combination of exception type and a function from the\ncall stack.", + "maxLength": 1024 + }, + "properties": { "type": "object", - "description": "An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.", - "required": [ - "exceptions" - ], - "properties": { - "exceptions": { - "type": "array", - "description": "Exception chain - list of inner exceptions.", - "items": { - "$ref": "#/definitions/ExceptionDetails" - } - }, - "severityLevel": { - "x-nullable": true, - "description": "Severity level. Mostly used to indicate exception severity level when it is reported by logging library.", - "$ref": "#/definitions/SeverityLevel" - }, - "problemId": { - "type": "string", - "description": "Identifier of where the exception was thrown in code. Used for exceptions grouping. Typically a combination of exception type and a function from the call stack.", - "maxLength": 1024 - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" + } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" } } + }, + "required": [ + "exceptions" + ], + "allOf": [ + { + "$ref": "#/definitions/Domain" + } ] }, "ExceptionDetails": { - "x-ms-client-name": "TelemetryExceptionDetails", "type": "object", "description": "Exception details of the exception in a chain.", - "required": [ - "message" - ], "properties": { "id": { - "type": "number", + "type": "integer", "format": "int32", - "description": "In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting." + "description": "In case exception is nested (outer exception contains inner one), the id and\nouterId properties are used to represent the nesting." }, "outerId": { - "type": "number", + "type": "integer", "format": "int32", - "description": "The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception" + "description": "The value of outerId is a reference to an element in ExceptionDetails that\nrepresents the outer exception" }, "typeName": { "type": "string", @@ -378,8 +423,8 @@ }, "hasFullStack": { "type": "boolean", - "default": true, - "description": "Indicates if full exception stack is provided in the exception. The stack may be trimmed, such as in the case of a StackOverflow exception." + "description": "Indicates if full exception stack is provided in the exception. The stack may\nbe trimmed, such as in the case of a StackOverflow exception.", + "default": true }, "stack": { "type": "string", @@ -393,348 +438,333 @@ "$ref": "#/definitions/StackFrame" } } - } + }, + "required": [ + "message" + ] }, "MessageData": { - "allOf": [ - { - "$ref": "#/definitions/Domain" + "type": "object", + "description": "Instances of Message represent printf-like trace statements that are\ntext-searched. Log4Net, NLog and other text-based log file entries are\ntranslated into instances of this type. The message does not have measurements.", + "properties": { + "message": { + "type": "string", + "description": "Trace message", + "maxLength": 32768 }, - { + "severityLevel": { + "$ref": "#/definitions/SeverityLevel", + "description": "Trace severity level." + }, + "properties": { "type": "object", - "description": "Instances of Message represent printf-like trace statements that are text-searched. Log4Net, NLog and other text-based log file entries are translated into instances of this type. The message does not have measurements.", - "required": [ - "message" - ], - "properties": { - "message": { - "type": "string", - "description": "Trace message", - "maxLength": 32768 - }, - "severityLevel": { - "$ref": "#/definitions/SeverityLevel", - "description": "Trace severity level." - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" } - } - ] - }, - "MetricsData": { - "allOf": [ - { - "$ref": "#/definitions/Domain" }, - { + "measurements": { "type": "object", - "description": "An instance of the Metric item is a list of measurements (single data points) and/or aggregations.", - "required": [ - "metrics" - ], - "properties": { - "metrics": { - "type": "array", - "description": "List of metrics. Only one metric in the list is currently supported by Application Insights storage. If multiple data points were sent only the first one will be used.", - "items": { - "$ref": "#/definitions/DataPoint" - } - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - } + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" } } - ] - }, - "PageViewData": { + }, + "required": [ + "message" + ], "allOf": [ { "$ref": "#/definitions/Domain" + } + ] + }, + "MetricsData": { + "type": "object", + "description": "An instance of the Metric item is a list of measurements (single data points)\nand/or aggregations.", + "properties": { + "metrics": { + "type": "array", + "description": "List of metrics. Only one metric in the list is currently supported by\nApplication Insights storage. If multiple data points were sent only the first\none will be used.", + "items": { + "$ref": "#/definitions/DataPoint" + } }, - { + "properties": { "type": "object", - "description": "An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "Identifier of a page view instance. Used for correlation between page view and other telemetry items.", - "maxLength": 512 - }, - "name": { - "type": "string", - "description": "Event name. Keep it low cardinality to allow proper grouping and useful metrics.", - "maxLength": 1024 - }, - "url": { - "type": "string", - "description": "Request URL with all query string parameters", - "maxLength": 2048 - }, - "duration": { - "type": "string", - "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days." - }, - "referredUri": { - "type": "string", - "description": "Fully qualified page URI or URL of the referring page; if unknown, leave blank", - "maxLength": 2048 - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" } } - ] - }, - "PageViewPerfData": { + }, + "required": [ + "metrics" + ], "allOf": [ { "$ref": "#/definitions/Domain" + } + ] + }, + "PageViewData": { + "type": "object", + "description": "An instance of PageView represents a generic action on a page like a button\nclick. It is also the base type for PageView.", + "properties": { + "id": { + "type": "string", + "description": "Identifier of a page view instance. Used for correlation between page view and\nother telemetry items.", + "maxLength": 512 }, - { + "name": { + "type": "string", + "description": "Event name. Keep it low cardinality to allow proper grouping and useful metrics.", + "maxLength": 1024 + }, + "url": { + "type": "string", + "description": "Request URL with all query string parameters", + "maxLength": 2048 + }, + "duration": { + "type": "string", + "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData),\nthis is the duration. For a page view with performance information\n(PageViewPerfData), this is the page load time. Must be less than 1000 days." + }, + "referredUri": { + "type": "string", + "description": "Fully qualified page URI or URL of the referring page; if unknown, leave blank", + "maxLength": 2048 + }, + "properties": { "type": "object", - "description": "An instance of PageViewPerf represents: a page view with no performance data, a page view with performance data, or just the performance data of an earlier page request.", - "required": [ - "id", - "name" - ], - "properties": { - "id": { - "type": "string", - "description": "Identifier of a page view instance. Used for correlation between page view and other telemetry items.", - "maxLength": 512 - }, - "name": { - "type": "string", - "description": "Event name. Keep it low cardinality to allow proper grouping and useful metrics.", - "maxLength": 1024 - }, - "url": { - "type": "string", - "description": "Request URL with all query string parameters", - "maxLength": 2048 - }, - "duration": { - "type": "string", - "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData), this is the duration. For a page view with performance information (PageViewPerfData), this is the page load time. Must be less than 1000 days." - }, - "perfTotal": { - "type": "string", - "description": "Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" - }, - "networkConnect": { - "type": "string", - "description": "Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" - }, - "sentRequest": { - "type": "string", - "description": "Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" - }, - "receivedResponse": { - "type": "string", - "description": "Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" - }, - "domProcessing": { - "type": "string", - "description": "DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" + } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" } } - ] - }, - "RemoteDependencyData": { + }, + "required": [ + "id", + "name" + ], "allOf": [ { "$ref": "#/definitions/Domain" + } + ] + }, + "PageViewPerfData": { + "type": "object", + "description": "An instance of PageViewPerf represents: a page view with no performance data, a\npage view with performance data, or just the performance data of an earlier\npage request.", + "properties": { + "id": { + "type": "string", + "description": "Identifier of a page view instance. Used for correlation between page view and\nother telemetry items.", + "maxLength": 512 }, - { + "name": { + "type": "string", + "description": "Event name. Keep it low cardinality to allow proper grouping and useful metrics.", + "maxLength": 1024 + }, + "url": { + "type": "string", + "description": "Request URL with all query string parameters", + "maxLength": 2048 + }, + "duration": { + "type": "string", + "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. For a page view (PageViewData),\nthis is the duration. For a page view with performance information\n(PageViewPerfData), this is the page load time. Must be less than 1000 days." + }, + "perfTotal": { + "type": "string", + "description": "Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" + }, + "networkConnect": { + "type": "string", + "description": "Network connection time in TimeSpan 'G' (general long) format:\nd:hh:mm:ss.fffffff" + }, + "sentRequest": { + "type": "string", + "description": "Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" + }, + "receivedResponse": { + "type": "string", + "description": "Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" + }, + "domProcessing": { + "type": "string", + "description": "DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff" + }, + "properties": { "type": "object", - "description": "An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint.", - "required": [ - "name", - "duration" - ], - "properties": { - "id": { - "type": "string", - "description": "Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call.", - "maxLength": 512 - }, - "name": { - "type": "string", - "description": "Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.", - "maxLength": 1024 - }, - "resultCode": { - "type": "string", - "description": "Result code of a dependency call. Examples are SQL error code and HTTP status code.", - "maxLength": 1024 - }, - "data": { - "type": "string", - "description": "Command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters.", - "maxLength": 8192 - }, - "type": { - "type": "string", - "description": "Dependency type name. Very low cardinality value for logical grouping of dependencies and interpretation of other fields like commandName and resultCode. Examples are SQL, Azure table, and HTTP.", - "maxLength": 1024 - }, - "target": { - "type": "string", - "description": "Target site of a dependency call. Examples are server name, host address.", - "maxLength": 1024 - }, - "duration": { - "type": "string", - "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days." - }, - "success": { - "type": "boolean", - "description": "Indication of successful or unsuccessful call.", - "default": true - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" + } + } + }, + "required": [ + "id", + "name" + ], + "allOf": [ + { + "$ref": "#/definitions/Domain" } ] }, - "RequestData": { + "RemoteDependencyData": { + "type": "object", + "description": "An instance of Remote Dependency represents an interaction of the monitored\ncomponent with a remote component/service like SQL or an HTTP endpoint.", + "properties": { + "id": { + "type": "string", + "description": "Identifier of a dependency call instance. Used for correlation with the request\ntelemetry item corresponding to this dependency call.", + "maxLength": 512 + }, + "name": { + "type": "string", + "description": "Name of the command initiated with this dependency call. Low cardinality value.\nExamples are stored procedure name and URL path template.", + "maxLength": 1024 + }, + "resultCode": { + "type": "string", + "description": "Result code of a dependency call. Examples are SQL error code and HTTP status\ncode.", + "maxLength": 1024 + }, + "data": { + "type": "string", + "description": "Command initiated by this dependency call. Examples are SQL statement and HTTP\nURL with all query parameters.", + "maxLength": 8192 + }, + "type": { + "type": "string", + "description": "Dependency type name. Very low cardinality value for logical grouping of\ndependencies and interpretation of other fields like commandName and\nresultCode. Examples are SQL, Azure table, and HTTP.", + "maxLength": 1024 + }, + "target": { + "type": "string", + "description": "Target site of a dependency call. Examples are server name, host address.", + "maxLength": 1024 + }, + "duration": { + "type": "string", + "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days." + }, + "success": { + "type": "boolean", + "description": "Indication of successful or unsuccessful call.", + "default": true + }, + "properties": { + "type": "object", + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" + } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" + } + } + }, + "required": [ + "name", + "duration" + ], "allOf": [ { "$ref": "#/definitions/Domain" + } + ] + }, + "RequestData": { + "type": "object", + "description": "An instance of Request represents completion of an external request to the\napplication to do work and contains a summary of that request execution and the\nresults.", + "properties": { + "id": { + "type": "string", + "description": "Identifier of a request call instance. Used for correlation between request and\nother telemetry items.", + "maxLength": 512 }, - { + "name": { + "type": "string", + "description": "Name of the request. Represents code path taken to process request. Low\ncardinality value to allow better grouping of requests. For HTTP requests it\nrepresents the HTTP method and URL path template like 'GET /values/{id}'.", + "maxLength": 1024 + }, + "duration": { + "type": "string", + "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days." + }, + "success": { + "type": "boolean", + "description": "Indication of successful or unsuccessful call.", + "default": true + }, + "responseCode": { + "type": "string", + "description": "Result of a request execution. HTTP status code for HTTP requests.", + "maxLength": 1024 + }, + "source": { + "type": "string", + "description": "Source of the request. Examples are the instrumentation key of the caller or\nthe ip address of the caller.", + "maxLength": 1024 + }, + "url": { + "type": "string", + "description": "Request URL with all query string parameters.", + "maxLength": 2048 + }, + "properties": { "type": "object", - "description": "An instance of Request represents completion of an external request to the application to do work and contains a summary of that request execution and the results.", - "required": [ - "id", - "duration", - "responseCode", - "success" - ], - "properties": { - "id": { - "type": "string", - "description": "Identifier of a request call instance. Used for correlation between request and other telemetry items.", - "maxLength": 512 - }, - "name": { - "type": "string", - "description": "Name of the request. Represents code path taken to process request. Low cardinality value to allow better grouping of requests. For HTTP requests it represents the HTTP method and URL path template like 'GET /values/{id}'.", - "maxLength": 1024 - }, - "duration": { - "type": "string", - "description": "Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days." - }, - "success": { - "type": "boolean", - "description": "Indication of successful or unsuccessful call.", - "default": true - }, - "responseCode": { - "type": "string", - "description": "Result of a request execution. HTTP status code for HTTP requests.", - "maxLength": 1024 - }, - "source": { - "type": "string", - "description": "Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller.", - "maxLength": 1024 - }, - "url": { - "type": "string", - "description": "Request URL with all query string parameters.", - "maxLength": 2048 - }, - "properties": { - "type": "object", - "description": "Collection of custom properties.", - "additionalProperties": { - "type": "string", - "maxLength": 8192 - } - }, - "measurements": { - "type": "object", - "description": "Collection of custom measurements.", - "additionalProperties": { - "type": "number", - "format": "double" - } - } + "description": "Collection of custom properties.", + "additionalProperties": { + "type": "string" + } + }, + "measurements": { + "type": "object", + "description": "Collection of custom measurements.", + "additionalProperties": { + "format": "double", + "type": "number" } } + }, + "required": [ + "id", + "duration", + "success", + "responseCode" + ], + "allOf": [ + { + "$ref": "#/definitions/Domain" + } ] }, "SeverityLevel": { @@ -746,20 +776,47 @@ "Warning", "Error", "Critical" - ] + ], + "x-ms-enum": { + "name": "SeverityLevel", + "modelAsString": true, + "values": [ + { + "name": "Verbose", + "value": "Verbose", + "description": "Verbose level." + }, + { + "name": "Information", + "value": "Information", + "description": "Information level." + }, + { + "name": "Warning", + "value": "Warning", + "description": "Warning level." + }, + { + "name": "Error", + "value": "Error", + "description": "Error level." + }, + { + "name": "Critical", + "value": "Critical", + "description": "Critical level." + } + ] + } }, "StackFrame": { "type": "object", "description": "Stack frame information.", - "required": [ - "level", - "method" - ], "properties": { "level": { - "type": "number", + "type": "integer", "format": "int32", - "description": "" + "description": "Level in the stack." }, "method": { "type": "string", @@ -777,71 +834,25 @@ "maxLength": 1024 }, "line": { - "type": "number", + "type": "integer", "format": "int32", "description": "Line number of the code implementation." } - } - }, - "TrackResponse": { - "description": "Response containing the status of each telemetry item.", - "type": "object", - "properties": { - "itemsReceived": { - "type": "number", - "format": "int32", - "description": "The number of items received." - }, - "itemsAccepted": { - "type": "number", - "format": "int32", - "description": "The number of items accepted." - }, - "errors": { - "type": "array", - "description": "An array of error detail objects.", - "items": { - "$ref": "#/definitions/ErrorDetails" - } - } - } - }, - "ErrorDetails": { - "x-ms-client-name": "TelemetryErrorDetails", - "description": "The error details", - "type": "object", - "properties": { - "index": { - "type": "number", - "format": "int32", - "description": "The index in the original payload of the item." - }, - "statusCode": { - "type": "number", - "format": "int32", - "description": "The item specific [HTTP Response status code](#Response Status Codes)." - }, - "message": { - "type": "string", - "description": "The error message." - } - } + }, + "required": [ + "level", + "method" + ] }, "TelemetryEnvelope": { - "x-ms-client-name": "TelemetryItem", - "description": "System variables for a telemetry item.", "type": "object", - "required": [ - "name", - "time" - ], + "description": "System variables for a telemetry item.", "properties": { "ver": { - "type": "number", - "x-ms-client-name": "version", + "type": "integer", "format": "int32", - "default": 1, - "description": "Envelope version. For internal use only. By assigning this the default, it will not be serialized within the payload unless changed to a value other than #1." + "description": "Envelope version. For internal use only. By assigning this the default, it will\nnot be serialized within the payload unless changed to a value other than #1.", + "default": 1 }, "name": { "type": "string", @@ -850,28 +861,26 @@ "time": { "type": "string", "format": "date-time", - "description": "Event date time when telemetry item was created. This is the wall clock time on the client when the event was generated. There is no guarantee that the client's time is accurate. This field must be formatted in UTC ISO 8601 format, with a trailing 'Z' character, as described publicly on https://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds digits provided are variable (and unspecified). Consumers should handle this, i.e. managed code consumers should not use format 'O' for parsing as it specifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z." + "description": "Event date time when telemetry item was created. This is the wall clock time on\nthe client when the event was generated. There is no guarantee that the\nclient's time is accurate. This field must be formatted in UTC ISO 8601 format,\nwith a trailing 'Z' character, as described publicly on\nhttps://en.wikipedia.org/wiki/ISO_8601#UTC. Note: the number of decimal seconds\ndigits provided are variable (and unspecified). Consumers should handle this,\ni.e. managed code consumers should not use format 'O' for parsing as it\nspecifies a fixed length. Example: 2009-06-15T13:45:30.0000000Z." }, "sampleRate": { "type": "number", "format": "float", - "default": 100.0, - "description": "Sampling rate used in application. This telemetry item represents 100 / sampleRate actual telemetry items." + "description": "Sampling rate used in application. This telemetry item represents 100 /\nsampleRate actual telemetry items.", + "default": 100 }, "seq": { "type": "string", - "x-ms-client-name": "sequence", - "maxLength": 64, - "description": "Sequence field used to track absolute order of uploaded events." + "description": "Sequence field used to track absolute order of uploaded events.", + "maxLength": 64 }, "iKey": { "type": "string", - "x-ms-client-name": "instrumentationKey", "description": "The instrumentation key of the Application Insights resource." }, "tags": { "type": "object", - "description": "Key/value collection of context properties. See ContextTagKeys for information on available properties.", + "description": "Key/value collection of context properties. See ContextTagKeys for information\non available properties.", "additionalProperties": { "type": "string" } @@ -880,143 +889,35 @@ "$ref": "#/definitions/Base", "description": "Telemetry data item." } - } + }, + "required": [ + "name", + "time" + ] }, - "ContextTagKeys": { - "type": "string", - "description": "The context tag keys.", - "enum": [ - "ApplicationVersion", - "DeviceId", - "DeviceLocale", - "DeviceModel", - "DeviceOEMName", - "DeviceOSVersion", - "DeviceType", - "LocationIp", - "LocationCountry", - "LocationProvince", - "LocationCity", - "OperationId", - "OperationName", - "OperationParentId", - "OperationSyntheticSource", - "OperationCorrelationVector", - "SessionId", - "SessionIsFirst", - "UserAccountId", - "UserId", - "UserAuthUserId", - "CloudRole", - "CloudRoleVer", - "CloudRoleInstance", - "CloudLocation", - "InternalSdkVersion", - "InternalAgentVersion", - "InternalNodeName " - ], - "x-ms-enum": { - "name": "ContextTagKeys", - "modelAsString": true, - "values": [ - { - "value": "ai.application.ver" - }, - { - "value": "ai.device.id" - }, - { - "value": "ai.device.locale" - }, - { - "value": "ai.device.model" - }, - { - "value": "ai.device.oemName" - }, - { - "value": "ai.device.osVersion" - }, - { - "value": "ai.device.type" - }, - { - "value": "ai.location.ip" - }, - { - "value": "ai.location.country" - }, - { - "value": "ai.location.province" - }, - { - "value": "ai.location.city" - }, - { - "value": "ai.operation.id" - }, - { - "value": "ai.operation.name" - }, - { - "value": "ai.operation.parentId" - }, - { - "value": "ai.operation.syntheticSource" - }, - { - "value": "ai.operation.correlationVector" - }, - { - "value": "ai.session.id" - }, - { - "value": "ai.session.isFirst" - }, - { - "value": "ai.user.accountId" - }, - { - "value": "ai.user.id" - }, - { - "value": "ai.user.authUserId" - }, - { - "value": "ai.cloud.role" - }, - { - "value": "ai.cloud.roleVer" - }, - { - "value": "ai.cloud.roleInstance" - }, - { - "value": "ai.cloud.location" - }, - { - "value": "ai.internal.sdkVersion" - }, - { - "value": "ai.internal.agentVersion" - }, - { - "value": "ai.internal.nodeName" + "TrackResponse": { + "type": "object", + "description": "Response containing the status of each telemetry item.", + "properties": { + "itemsReceived": { + "type": "integer", + "format": "int32", + "description": "The number of items received." + }, + "itemsAccepted": { + "type": "integer", + "format": "int32", + "description": "The number of items accepted." + }, + "errors": { + "type": "array", + "description": "An array of error detail objects.", + "items": { + "$ref": "#/definitions/ErrorDetails" } - ] + } } } }, - "parameters": { - "Host": { - "name": "Host", - "description": "Breeze endpoint: https://dc.services.visualstudio.com", - "x-ms-parameter-location": "client", - "default": "https://dc.services.visualstudio.com", - "required": true, - "type": "string", - "in": "path", - "x-ms-skip-url-encoding": true - } - } + "parameters": {} } diff --git a/specification/applicationinsights/suppressions.yaml b/specification/applicationinsights/suppressions.yaml new file mode 100644 index 000000000000..e2c376506bac --- /dev/null +++ b/specification/applicationinsights/suppressions.yaml @@ -0,0 +1,7 @@ +- tool: TypeSpecValidation + reason: Suppress until Go needs to generate SDK + rules: [SdkTspConfigValidation] + sub-rules: + - options.@azure-tools/typespec-go.* + paths: + - ApplicationInsights.Monitor.Exporters/tspconfig.yaml