This commit is contained in:
Sergey Kanzhelev 2018-04-25 11:35:44 -07:00
Родитель 0d9fd3eb7f
Коммит 2e2b84bf75
39 изменённых файлов: 809 добавлений и 87 удалений

Просмотреть файл

@ -0,0 +1,47 @@
import "Domain.bond"
namespace AI
[Description("Instances of AvailabilityData represent the result of executing an availability test.")]
struct AvailabilityData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[MaxStringLength("64")]
[Description("Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service.")]
[ActAsRequired("Renaming testRunId to id.")]
21: required string id;
[MaxStringLength("1024")]
[Description("Name of the test that these availability results represent.")]
[ActAsRequired("Renaming testName to name.")]
41: required string name;
[Description("Duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.")]
[CSType("TimeSpan")]
50: required string duration;
[ActAsRequired("Renaming result to success.")]
[Description("Success flag.")]
61: required bool success;
[MaxStringLength("1024")]
[Description("Name of the location where the test was run from.")]
70: string runLocation;
[MaxStringLength("8192")]
[Description("Diagnostic message for the result.")]
80: string message;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
100: map<string, string> properties;
[Description("Collection of custom measurements.")]
[MaxKeyLength("150")]
200: map<string, double> measurements;
}

Просмотреть файл

@ -0,0 +1,11 @@
namespace AI
[Description("Data struct to contain only C section with custom fields.")]
struct Base
{
[Name("ItemTypeName")]
[Description("Name of item (B section) if any. If telemetry data is derived straight from this, this should be null.")]
10: string baseType;
}

Просмотреть файл

@ -0,0 +1,101 @@
namespace AI
[ContextContract("Emit")]
[PseudoType("JSMap")]
struct ContextTagKeys
{
[Description("Application version. Information in the application context fields is always about the application that is sending the telemetry.")]
[MaxStringLength("1024")]
10: string ApplicationVersion = "ai.application.ver";
[Description("Unique client device id. Computer name in most cases.")]
[MaxStringLength("1024")]
100: string DeviceId = "ai.device.id";
[Description("Device locale using <language>-<REGION> pattern, following RFC 5646. Example 'en-US'.")]
[MaxStringLength("64")]
115: string DeviceLocale = "ai.device.locale";
[Description("Model of the device the end user of the application is using. Used for client scenarios. If this field is empty then it is derived from the user agent.")]
[MaxStringLength("256")]
120: string DeviceModel = "ai.device.model";
[Description("Client device OEM name taken from the browser.")]
[MaxStringLength("256")]
130: string DeviceOEMName = "ai.device.oemName";
[Description("Operating system name and version of the device the end user of the application is using. If this field is empty then it is derived from the user agent. Example 'Windows 10 Pro 10.0.10586.0'")]
[MaxStringLength("256")]
140: string DeviceOSVersion = "ai.device.osVersion";
[Description("The type of the device the end user of the application is using. Used primarily to distinguish JavaScript telemetry from server side telemetry. Examples: 'PC', 'Phone', 'Browser'. 'PC' is the default value.")]
[MaxStringLength("64")]
160: string DeviceType = "ai.device.type";
[Description("The IP address of the client device. IPv4 and IPv6 are supported. Information in the location context fields is always about the end user. When telemetry is sent from a service, the location context is about the user that initiated the operation in the service.")]
[MaxStringLength("46")]
200: string LocationIp = "ai.location.ip";
[Description("A unique identifier for the operation instance. The operation.id is created by either a request or a page view. All other telemetry sets this to the value for the containing request or page view. Operation.id is used for finding all the telemetry items for a specific operation instance.")]
[MaxStringLength("128")]
300: string OperationId = "ai.operation.id";
[Description("The name (group) of the operation. The operation.name is created by either a request or a page view. All other telemetry items set this to the value for the containing request or page view. Operation.name is used for finding all the telemetry items for a group of operations (i.e. 'GET Home/Index').")]
[MaxStringLength("1024")]
305: string OperationName = "ai.operation.name";
[Description("The unique identifier of the telemetry item's immediate parent.")]
[MaxStringLength("128")]
310: string OperationParentId = "ai.operation.parentId";
[Description("Name of synthetic source. Some telemetry from the application may represent a synthetic traffic. It may be web crawler indexing the web site, site availability tests or traces from diagnostic libraries like Application Insights SDK itself.")]
[MaxStringLength("1024")]
320: string OperationSyntheticSource = "ai.operation.syntheticSource";
[Description("The correlation vector is a light weight vector clock which can be used to identify and order related events across clients and services.")]
[MaxStringLength("64")]
330: string OperationCorrelationVector = "ai.operation.correlationVector";
[Description("Session ID - the instance of the user's interaction with the app. Information in the session context fields is always about the end user. When telemetry is sent from a service, the session context is about the user that initiated the operation in the service.")]
[MaxStringLength("64")]
400: string SessionId = "ai.session.id";
[Description("Boolean value indicating whether the session identified by ai.session.id is first for the user or not.")]
[MaxStringLength("5")]
[Question("Should it be marked as JSType-bool for breeze?")]
405: string SessionIsFirst = "ai.session.isFirst";
[Description("In multi-tenant applications this is the account ID or name which the user is acting with. Examples may be subscription ID for Azure portal or blog name blogging platform.")]
[MaxStringLength("1024")]
505: string UserAccountId = "ai.user.accountId";
[Description("Anonymous user id. Represents the end user of the application. When telemetry is sent from a service, the user context is about the user that initiated the operation in the service.")]
[MaxStringLength("128")]
515: string UserId = "ai.user.id";
[Description("Authenticated user id. The opposite of ai.user.id, this represents the user with a friendly name. Since it's PII information it is not collected by default by most SDKs.")]
[MaxStringLength("1024")]
525: string UserAuthUserId = "ai.user.authUserId";
[Description("Name of the role the application is a part of. Maps directly to the role name in azure.")]
[MaxStringLength("256")]
705: string CloudRole = "ai.cloud.role";
[Description("Name of the instance where the application is running. Computer name for on-premisis, instance name for Azure.")]
[MaxStringLength("256")]
715: string CloudRoleInstance = "ai.cloud.roleInstance";
[Description("SDK version. See https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification for information.")]
[MaxStringLength("64")]
1000: string InternalSdkVersion = "ai.internal.sdkVersion";
[Description("Agent version. Used to indicate the version of StatusMonitor installed on the computer if it is used for data collection.")]
[MaxStringLength("64")]
1001: string InternalAgentVersion = "ai.internal.agentVersion";
[Description("This is the node name used for billing purposes. Use it to override the standard detection of nodes.")]
[MaxStringLength("256")]
1002: string InternalNodeName = "ai.internal.nodeName";
}

Просмотреть файл

@ -0,0 +1,13 @@
import "Base.bond"
namespace AI
[Description("Data struct to contain both B and C sections.")]
struct Data<TDomain>
: Base
{
[Name("Item")]
[Description("Container for data item (B section).")]
20: required TDomain baseData;
}

Просмотреть файл

@ -0,0 +1,34 @@
import "DataPointType.bond"
namespace AI
[Description("Metric data single measurement.")]
struct DataPoint
{
[Description("Namespace of the metric.")]
[MaxStringLength("256")]
5: string ns;
[Description("Name of the metric.")]
[MaxStringLength("1024")]
10: required string name;
[Description("Metric type. Single measurement or the aggregated value.")]
20: AI.DataPointType kind = Measurement;
[Description("Single value for measurement. Sum of individual measurements for the aggregation.")]
30: required double value;
[Description("Metric weight of the aggregated metric. Should not be set for a measurement.")]
40: nullable<int32> count;
[Description("Minimum value of the aggregated metric. Should not be set for a measurement.")]
50: nullable<double> min;
[Description("Maximum value of the aggregated metric. Should not be set for a measurement.")]
60: nullable<double> max;
[Description("Standard deviation of the aggregated metric. Should not be set for a measurement.")]
70: nullable<double> stdDev;
}

Просмотреть файл

@ -0,0 +1,8 @@
namespace AI
[Description("Type of the metric data measurement.")]
enum DataPointType
{
Measurement,
Aggregation,
}

Просмотреть файл

@ -0,0 +1,7 @@
namespace AI
[Description("The abstract common base of all domains.")]
struct Domain
{
}

Просмотреть файл

@ -0,0 +1,50 @@
import "Base.bond"
namespace AI
[Description("System variables for a telemetry item.")]
struct Envelope
{
[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.")]
[Name("SchemaVersion")]
10: int32 ver = 1;
[Description("Type name of telemetry data item.")]
[Name("DataTypeName")]
[MaxStringLength("1024")]
20: required string name;
[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.")]
[Name("DateTime")]
[CSType("DateTimeOffset")]
[JSType("Date")]
[HockeyAppMinDateOffsetFromNow("2592000000")]
[MinDateOffsetFromNow("172800000")]
[MaxDateOffsetFromNow("7200000")]
[MaxStringLength("64")]
30: required string time;
[Name("SamplingRate")]
[Description("Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.")]
40: double sampleRate = 100.0;
[Description("Sequence field used to track absolute order of uploaded events.")]
[Name("SequenceNumber")]
[MaxStringLength("64")]
50: string seq;
[Description("The application's instrumentation key. The key is typically represented as a GUID, but there are cases when it is not a guid. No code should rely on iKey being a GUID. Instrumentation key is case insensitive.")]
[Name("InstrumentationKey")]
[MaxStringLength("40")]
60: string iKey;
[Name("Tags")]
[TypeAlias("ContextTagKeys")]
[Description("Key/value collection of context properties. See ContextTagKeys for information on available properties.")]
500: map<string, string> tags;
[Name("TelemetryData")]
[Description("Telemetry data item.")]
999: Base data;
}

Просмотреть файл

@ -0,0 +1,26 @@
import "Domain.bond"
namespace AI
[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.")]
struct EventData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[MaxStringLength("512")]
[Description("Event name. Keep it low cardinality to allow proper grouping and useful metrics.")]
[Question("Why Custom Event name is shorter than Request name or dependency name?")]
20: required string name;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
100: map<string, string> properties;
[Description("Collection of custom measurements.")]
[MaxKeyLength("150")]
200: map<string, double> measurements;
}

Просмотреть файл

@ -0,0 +1,33 @@
import "Domain.bond"
import "ExceptionDetails.bond"
import "SeverityLevel.bond"
namespace AI
[Description("An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.")]
struct ExceptionData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[Description("Exception chain - list of inner exceptions.")]
50: required vector<ExceptionDetails> exceptions;
[Description("Severity level. Mostly used to indicate exception severity level when it is reported by logging library.")]
60: nullable<AI.SeverityLevel> severityLevel;
[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.")]
[MaxStringLength("1024")]
80: string problemId;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
100: map<string, string> properties;
[Description("Collection of custom measurements.")]
[MaxKeyLength("150")]
200: map<string, double> measurements;
}

Просмотреть файл

@ -0,0 +1,32 @@
import "StackFrame.bond"
namespace AI
[Description("Exception details of the exception in a chain.")]
struct ExceptionDetails
{
[Description("In case exception is nested (outer exception contains inner one), the id and outerId properties are used to represent the nesting.")]
10: int32 id;
[Description("The value of outerId is a reference to an element in ExceptionDetails that represents the outer exception")]
20: int32 outerId;
[Description("Exception type name.")]
[MaxStringLength("1024")]
30: required string typeName;
[Description("Exception message.")]
[MaxStringLength("32768")]
40: required string message;
[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.")]
50: bool hasFullStack = true;
[Description("Text describing the stack. Either stack or parsedStack should have a value.")]
[MaxStringLength("32768")]
60: string stack;
[Description("List of stack frames. Either stack or parsedStack should have a value.")]
70: vector<StackFrame> parsedStack;
}

Просмотреть файл

@ -0,0 +1,25 @@
import "Domain.bond"
import "SeverityLevel.bond"
namespace AI
[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 intances of this type. The message does not have measurements.")]
struct MessageData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[MaxStringLength("32768")]
[Description("Trace message")]
20: required string message;
[Description("Trace severity level.")]
30: nullable<AI.SeverityLevel> severityLevel;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
100: map<string, string> properties;
}

Просмотреть файл

@ -0,0 +1,21 @@
import "Domain.bond"
import "DataPoint.bond"
namespace AI
[Description("An instance of the Metric item is a list of measurements (single data points) and/or aggregations.")]
struct MetricData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[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.")]
20: required vector<DataPoint> metrics;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
100: map<string, string> properties;
}

Просмотреть файл

@ -0,0 +1,25 @@
import "EventData.bond"
namespace AI
[Description("An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.")]
[Alias("PageviewData;PageEventData")]
struct PageViewData
: EventData
{
[MaxStringLength("2048")]
[Description("Request URL with all query string parameters")]
10: string url;
[CSType("TimeSpan")]
[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.")]
20: string duration;
[MaxStringLength("128")]
[Description("Identifier of a page view instance. Used for correlation between page view and other telemetry items.")]
50: string id;
[MaxStringLength("2048")]
[Description("Fully qualified page URI or URL of the referring page; if unknown, leave blank.")]
60: string referrerUri;
}

Просмотреть файл

@ -0,0 +1,30 @@
import "PageViewData.bond"
namespace AI
[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.")]
[Alias("PageViewPerformanceData;PageviewPerformanceData")]
struct PageViewPerfData
: PageViewData
{
[Description("Performance total in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff")]
[CSType("TimeSpan")]
10: string perfTotal;
[Description("Network connection time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff")]
[CSType("TimeSpan")]
20: string networkConnect;
[Description("Sent request time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff")]
[CSType("TimeSpan")]
30: string sentRequest;
[Description("Received response time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff")]
[CSType("TimeSpan")]
40: string receivedResponse;
[Description("DOM processing time in TimeSpan 'G' (general long) format: d:hh:mm:ss.fffffff")]
[CSType("TimeSpan")]
50: string domProcessing;
}

Просмотреть файл

@ -0,0 +1,53 @@
import "Domain.bond"
namespace AI
[Description("An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint.")]
struct RemoteDependencyData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[MaxStringLength("1024")]
[Description("Name of the command initiated with this dependency call. Low cardinality value. Examples are stored procedure name and URL path template.")]
20: required string name;
[MaxStringLength("128")]
[Description("Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call.")]
30: string id;
[MaxStringLength("1024")]
[Description("Result code of a dependency call. Examples are SQL error code and HTTP status code.")]
40: string resultCode;
[CSType("TimeSpan")]
[Description("Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.")]
[ActAsRequired("Renaming value to duration.")]
61: required string duration;
[Description("Indication of successfull or unsuccessfull call.")]
120: nullable<bool> success = true;
[MaxStringLength("8192")]
[Description("Command initiated by this dependency call. Examples are SQL statement and HTTP URL's with all query parameters.")]
151: string data;
[MaxStringLength("1024")]
[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.")]
162: string type;
[MaxStringLength("1024")]
[Description("Target site of a dependency call. Examples are server name, host address.")]
161: string target;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
200: map<string, string> properties;
[Description("Collection of custom measurements.")]
[MaxKeyLength("150")]
300: map<string, double> measurements;
}

Просмотреть файл

@ -0,0 +1,48 @@
import "Domain.bond"
namespace AI
[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.")]
struct RequestData
: Domain
{
[Description("Schema version")]
10: required int32 ver = 2;
[MaxStringLength("128")]
[Description("Identifier of a request call instance. Used for correlation between request and other telemetry items.")]
20: required string id;
[CSType("TimeSpan")]
[Description("Request duration in format: DD.HH:MM:SS.MMMMMM. Must be less than 1000 days.")]
50: required string duration;
[MaxStringLength("1024")]
[Description("Result of a request execution. HTTP status code for HTTP requests.")]
60: required string responseCode;
[Description("Indication of successfull or unsuccessfull call.")]
70: required bool success;
[MaxStringLength("1024")]
[Description("Source of the request. Examples are the instrumentation key of the caller or the ip address of the caller.")]
29: string source;
[MaxStringLength("1024")]
[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}'.")]
30: string name;
[MaxStringLength("2048")]
[Description("Request URL with all query string parameters.")]
90: string url;
[Description("Collection of custom properties.")]
[MaxKeyLength("150")]
[MaxValueLength("8192")]
100: map<string, string> properties;
[Description("Collection of custom measurements.")]
[MaxKeyLength("150")]
200: map<string, double> measurements;
}

Просмотреть файл

@ -0,0 +1,11 @@
namespace AI
[Description("Defines the level of severity for the event.")]
enum SeverityLevel
{
Verbose,
Information,
Warning,
Error,
Critical,
}

Просмотреть файл

@ -0,0 +1,25 @@
namespace AI
[Description("Stack frame information.")]
struct StackFrame
{
[Description("Level in the call stack. For the long stacks SDK may not report every function in a call stack.")]
10: required int32 level;
[Description("Method name.")]
[MaxStringLength("1024")]
20: required string method;
[Description("Name of the assembly (dll, jar, etc.) containing this function.")]
[MaxStringLength("1024")]
30: string assembly;
[Description("File name or URL of the method implementation.")]
[MaxStringLength("1024")]
50: string fileName;
[Description("Line number of the code implementation.")]
60: int32 line;
}

51
Schema/generateSchema.ps1 Normal file
Просмотреть файл

@ -0,0 +1,51 @@
$generatorPath = "C:\src\mseng\AppInsights-Common"
$publicSchemaLocation = "https://raw.githubusercontent.com/Microsoft/ApplicationInsights-Home/master/EndpointSpecs/Schemas/Bond"
$schemasPath = "C:\src\github\ApplicationInsights\ruby\Schema\PublicSchema"
$currentDir = $scriptPath = split-path -parent $MyInvocation.MyCommand.Definition
#fix path
$generatorPath = "$generatorPath\..\bin\Debug\BondSchemaGenerator\BondSchemaGenerator"
#####################################################################
## PUBLIC SCHEMA
#####################################################################
mkdir -Force $currentDir\PublicSchema
function RegExReplace([string]$fileName, [string]$regex, [string]$replacement="")
{
$content = Get-Content $fileName
$content = $content -creplace $regex,$replacement
$content | Set-Content $fileName
}
# Download public schema from the github
@(
"AvailabilityData.bond",
"Base.bond",
"ContextTagKeys.bond",
"Data.bond",
"DataPoint.bond",
"DataPointType.bond",
"Domain.bond",
"Envelope.bond",
"EventData.bond",
"ExceptionData.bond",
"ExceptionDetails.bond",
"MessageData.bond",
"MetricData.bond",
"PageViewData.bond",
"PageViewPerfData.bond",
"RemoteDependencyData.bond",
"RequestData.bond",
"SeverityLevel.bond",
"StackFrame.bond"
) | ForEach-Object {
$fileName = $_
& Invoke-WebRequest -o "$currentDir\PublicSchema\$fileName" "$publicSchemaLocation/$fileName"
RegExReplace "$currentDir\PublicSchema\$fileName" "`n" "`r`n"
}
# Generate public schema using bond generator
& "$generatorPath\BondSchemaGenerator.exe" -v -i "$schemasPath\AvailabilityData.bond" -i "$schemasPath\Base.bond" -i "$schemasPath\ContextTagKeys.bond" -i "$schemasPath\Data.bond" -i "$schemasPath\DataPoint.bond" -i "$schemasPath\DataPointType.bond" -i "$schemasPath\Domain.bond" -i "$schemasPath\Envelope.bond" -i "$schemasPath\EventData.bond" -i "$schemasPath\ExceptionData.bond" -i "$schemasPath\ExceptionDetails.bond" -i "$schemasPath\MessageData.bond" -i "$schemasPath\MetricData.bond" -i "$schemasPath\PageViewData.bond" -i "$schemasPath\PageViewPerfData.bond" -i "$schemasPath\RemoteDependencyData.bond" -i "$schemasPath\RequestData.bond" -i "$schemasPath\SeverityLevel.bond" -i "$schemasPath\StackFrame.bond" -o "$currentDir\..\" -e RubyProductLanguage -t RubyProductLayout

Просмотреть файл

@ -4,11 +4,10 @@ module ApplicationInsights::Channel::Contracts
class Application
include JsonSerializable
attr_accessor :ver, :build
attr_accessor :ver
attribute_mapping(
ver: 'ai.application.ver',
build: 'ai.application.build'
ver: 'ai.application.ver'
)
end
end

Просмотреть файл

@ -0,0 +1,34 @@
require_relative 'json_serializable'
module ApplicationInsights::Channel::Contracts
class AvailabilityData
include JsonSerializable
attr_accessor :ver, :id, :name, :duration, :success, :run_location, :message,
:properties, :measurements
attribute_mapping(
ver: 'ver',
id: 'id',
name: 'name',
duration: 'duration',
success: 'success',
run_location: 'runLocation',
message: 'message',
properties: 'properties',
measurements: 'measurements'
)
def ver
@ver ||= 2
end
def properties
@properties ||= {}
end
def measurements
@measurements ||= {}
end
end
end

Просмотреть файл

@ -0,0 +1,13 @@
require_relative 'json_serializable'
module ApplicationInsights::Channel::Contracts
class Base
include JsonSerializable
attr_accessor :base_type
attribute_mapping(
base_type: 'baseType'
)
end
end

Просмотреть файл

@ -4,10 +4,10 @@ module ApplicationInsights::Channel::Contracts
class Cloud
include JsonSerializable
attr_accessor :role_name, :role_instance
attr_accessor :role, :role_instance
attribute_mapping(
role_name: 'ai.cloud.role',
role: 'ai.cloud.role',
role_instance: 'ai.cloud.roleInstance'
)
end

Просмотреть файл

@ -5,9 +5,10 @@ module ApplicationInsights::Channel::Contracts
class DataPoint
include JsonSerializable
attr_accessor :name, :kind, :value, :count, :min, :max, :std_dev
attr_accessor :ns, :name, :kind, :value, :count, :min, :max, :std_dev
attribute_mapping(
ns: 'ns',
name: 'name',
kind: 'kind',
value: 'value',

Просмотреть файл

@ -4,25 +4,15 @@ module ApplicationInsights::Channel::Contracts
class Device
include JsonSerializable
attr_accessor :id, :ip, :language, :locale, :model, :network, :oem_name,
:os, :os_version, :role_instance, :role_name, :screen_resolution, :type,
:machine_name
attr_accessor :id, :locale, :model, :oem_name, :os_version, :type
attribute_mapping(
id: 'ai.device.id',
ip: 'ai.device.ip',
language: 'ai.device.language',
locale: 'ai.device.locale',
model: 'ai.device.model',
network: 'ai.device.network',
oem_name: 'ai.device.oemName',
os: 'ai.device.os',
os_version: 'ai.device.osVersion',
role_instance: 'ai.device.roleInstance',
role_name: 'ai.device.roleName',
screen_resolution: 'ai.device.screenResolution',
type: 'ai.device.type',
machine_name: 'ai.device.machineName'
type: 'ai.device.type'
)
end
end

Просмотреть файл

@ -0,0 +1,12 @@
require_relative 'json_serializable'
module ApplicationInsights::Channel::Contracts
class Domain
include JsonSerializable
attr_accessor
attribute_mapping(
)
end
end

Просмотреть файл

@ -4,8 +4,7 @@ module ApplicationInsights::Channel::Contracts
class Envelope
include JsonSerializable
attr_accessor :ver, :name, :time, :sample_rate, :seq, :i_key, :flags, :device_id,
:os, :os_ver, :app_id, :app_ver, :user_id, :tags, :data
attr_accessor :ver, :name, :time, :sample_rate, :seq, :i_key, :tags, :data
attribute_mapping(
ver: 'ver',
@ -14,13 +13,6 @@ module ApplicationInsights::Channel::Contracts
sample_rate: 'sampleRate',
seq: 'seq',
i_key: 'iKey',
flags: 'flags',
device_id: 'deviceId',
os: 'os',
os_ver: 'osVer',
app_id: 'appId',
app_ver: 'appVer',
user_id: 'userId',
tags: 'tags',
data: 'data'
)

Просмотреть файл

@ -4,16 +4,14 @@ module ApplicationInsights::Channel::Contracts
class ExceptionData
include JsonSerializable
attr_accessor :ver, :handled_at, :exceptions, :severity_level, :problem_id,
:crash_thread_id, :properties, :measurements
attr_accessor :ver, :exceptions, :severity_level, :problem_id, :properties,
:measurements
attribute_mapping(
ver: 'ver',
handled_at: 'handledAt',
exceptions: 'exceptions',
severity_level: 'severityLevel',
problem_id: 'problemId',
crash_thread_id: 'crashThreadId',
properties: 'properties',
measurements: 'measurements'
)

Просмотреть файл

@ -4,11 +4,12 @@ module ApplicationInsights::Channel::Contracts
class Internal
include JsonSerializable
attr_accessor :sdk_version, :agent_version
attr_accessor :sdk_version, :agent_version, :node_name
attribute_mapping(
sdk_version: 'ai.internal.sdkVersion',
agent_version: 'ai.internal.agentVersion'
agent_version: 'ai.internal.agentVersion',
node_name: 'ai.internal.nodeName'
)
end
end

Просмотреть файл

@ -41,7 +41,7 @@ module ApplicationInsights
private
def visit(object)
return if object.nil?
return unless object
if object.is_a? Array
object.map { |e| visit e }

Просмотреть файл

@ -4,13 +4,10 @@ module ApplicationInsights::Channel::Contracts
class Location
include JsonSerializable
attr_accessor :ip, :country, :province, :city
attr_accessor :ip
attribute_mapping(
ip: 'ai.location.ip',
country: 'ai.location.country',
province: 'ai.location.province',
city: 'ai.location.city'
ip: 'ai.location.ip'
)
end
end

Просмотреть файл

@ -4,16 +4,14 @@ module ApplicationInsights::Channel::Contracts
class Operation
include JsonSerializable
attr_accessor :id, :name, :parent_id, :root_id, :synthetic_source, :is_synthetic, :correlation_vector
attr_accessor :id, :name, :parent_id, :synthetic_source, :correlation_vector
attribute_mapping(
id: 'ai.operation.id',
name: 'ai.operation.name',
parent_id: 'ai.operation.parentId',
root_id: 'ai.operation.rootId',
synthetic_source: 'ai.operation.syntheticSource',
is_synthetic: 'ai.operation.isSynthetic',
correlation_vector: "ai.operation.correlationVector"
correlation_vector: 'ai.operation.correlationVector'
)
end
end

Просмотреть файл

@ -4,13 +4,16 @@ module ApplicationInsights::Channel::Contracts
class PageViewData
include JsonSerializable
attr_accessor :ver, :url, :name, :duration, :properties, :measurements
attr_accessor :ver, :url, :name, :duration, :id, :referrer_uri, :properties,
:measurements
attribute_mapping(
ver: 'ver',
url: 'url',
name: 'name',
duration: 'duration',
id: 'id',
referrer_uri: 'referrerUri',
properties: 'properties',
measurements: 'measurements'
)

Просмотреть файл

@ -0,0 +1,55 @@
require_relative 'json_serializable'
module ApplicationInsights::Channel::Contracts
class PageViewPerfData
include JsonSerializable
attr_accessor :ver, :ver, :url, :perf_total, :name, :name, :duration, :network_connect,
:sent_request, :received_response, :id, :dom_processing, :referrer_uri,
:properties, :properties, :measurements:measurements
attribute_mapping(
ver: 'ver',
ver: 'ver',
url: 'url',
perf_total: 'perfTotal',
name: 'name',
name: 'name',
duration: 'duration',
network_connect: 'networkConnect',
sent_request: 'sentRequest',
received_response: 'receivedResponse',
id: 'id',
dom_processing: 'domProcessing',
referrer_uri: 'referrerUri',
properties: 'properties',
properties: 'properties',
measurements: 'measurements'
measurements: 'measurements'
)
def ver
@ver ||= 2
end
def ver
@ver ||= 2
end
def properties
@properties ||= {}
end
def properties
@properties ||= {}
end
def measurements
@measurements ||= {}
end
def measurements
@measurements ||= {}
end
end
end

Просмотреть файл

@ -1,56 +1,40 @@
require_relative 'json_serializable'
require_relative 'data_point_type'
require_relative 'dependency_kind'
require_relative 'dependency_source_type'
module ApplicationInsights::Channel::Contracts
class RemoteDependencyData
include JsonSerializable
attr_accessor :ver, :name, :kind, :value, :count, :min, :max, :std_dev,
:dependency_kind, :success, :async, :dependency_source, :command_name,
:dependency_type_name, :properties
attr_accessor :ver, :name, :id, :result_code, :duration, :success, :data,
:target, :type, :properties, :measurements
attribute_mapping(
ver: 'ver',
name: 'name',
kind: 'kind',
value: 'value',
count: 'count',
min: 'min',
max: 'max',
std_dev: 'stdDev',
dependency_kind: 'dependencyKind',
id: 'id',
result_code: 'resultCode',
duration: 'duration',
success: 'success',
async: 'async',
dependency_source: 'dependencySource',
command_name: 'commandName',
dependency_type_name: 'dependencyTypeName',
properties: 'properties'
data: 'data',
target: 'target',
type: 'type',
properties: 'properties',
measurements: 'measurements'
)
def ver
@ver ||= 2
end
def kind
@kind ||= DataPointType::MEASUREMENT
end
def dependency_kind
@dependency_kind ||= DependencyKind::OTHER
end
def success
@success.nil? ? true : @success
end
def dependency_source
@dependency_source ||= DependencySourceType::UNDEFINED
end
def properties
@properties ||= {}
end
def measurements
@measurements ||= {}
end
end
end

Просмотреть файл

@ -4,18 +4,17 @@ module ApplicationInsights::Channel::Contracts
class RequestData
include JsonSerializable
attr_accessor :ver, :id, :name, :start_time, :duration, :response_code,
:success, :http_method, :url, :properties, :measurements
attr_accessor :ver, :id, :source, :name, :duration, :response_code, :success,
:url, :properties, :measurements
attribute_mapping(
ver: 'ver',
id: 'id',
source: 'source',
name: 'name',
start_time: 'startTime',
duration: 'duration',
response_code: 'responseCode',
success: 'success',
http_method: 'httpMethod',
url: 'url',
properties: 'properties',
measurements: 'measurements'

Просмотреть файл

@ -4,12 +4,11 @@ module ApplicationInsights::Channel::Contracts
class Session
include JsonSerializable
attr_accessor :id, :is_first, :is_new
attr_accessor :id, :is_first
attribute_mapping(
id: 'ai.session.id',
is_first: 'ai.session.isFirst',
is_new: 'ai.session.isNew'
is_first: 'ai.session.isFirst'
)
end
end

Просмотреть файл

@ -4,16 +4,12 @@ module ApplicationInsights::Channel::Contracts
class User
include JsonSerializable
attr_accessor :account_acquisition_date, :account_id, :auth_user_id, :user_agent, :id,
:store_region
attr_accessor :account_id, :id, :auth_user_id
attribute_mapping(
account_acquisition_date: 'ai.user.accountAcquisitionDate',
account_id: 'ai.user.accountId',
user_agent: 'ai.user.userAgent',
id: 'ai.user.id',
auth_user_id: 'ai.user.authUserId',
store_region: 'ai.user.storeRegion'
auth_user_id: 'ai.user.authUserId'
)
end
end