Skip to content

Commit

Permalink
[Monitor][Codegen] Use generated TelemetryItem (as Envelope) (#11280)
Browse files Browse the repository at this point in the history
* codegen: use generated Envelope

* integrate with generated client

* run tests on serialized payloads

* prettier update

* test on latest swagger

* check in mock swagger

* swagger styling

* try RequestTelemetry schema

* use latest codegen

* use latest swagger

* fix unreachable code

* Update sdk/monitor/monitor-opentelemetry-exporter/src/platform/nodejs/httpSender.ts

Co-authored-by: Jeff Fisher <jeffish@microsoft.com>

* refactor spanUtils envelope creation

Co-authored-by: Jeff Fisher <jeffish@microsoft.com>
  • Loading branch information
markwolff and xirzec authored Oct 8, 2020
1 parent 7de0532 commit 5a4d307
Show file tree
Hide file tree
Showing 21 changed files with 226 additions and 366 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,3 @@ export import Base = require("./Base");
export import ContextTagKeys = require("./ContextTagKeys");
export import Data = require("./Data");
export import Domain = require("./Domain");
export import Envelope = require("./Envelope");
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@

import { Logger } from "@opentelemetry/api";
import { ConsoleLogger, LogLevel, ExportResult } from "@opentelemetry/core";
import { Envelope } from "../Declarations/Contracts";
import { ConnectionStringParser } from "../utils/connectionStringParser";
import { HttpSender, FileSystemPersist } from "../platform";
import { DEFAULT_EXPORTER_CONFIG, AzureExporterConfig } from "../config";
import { BaseExporter, TelemetryProcessor, PersistentStorage, Sender } from "../types";
import { isRetriable, BreezeResponse } from "../utils/breezeUtils";
import { ENV_CONNECTION_STRING, ENV_INSTRUMENTATION_KEY } from "../Declarations/Constants";
import { TelemetryItem as Envelope } from "../generated";

export abstract class AzureMonitorBaseExporter implements BaseExporter {
protected readonly _persister: PersistentStorage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ export class ApplicationInsightsClient extends ApplicationInsightsClientContext
}

/**
* This operation generates a model using an entire series, each point is detected with the same model.
* With this method, points before and after a certain point are used to determine whether it is an
* anomaly. The entire detection can give user an overall status of the time series.
* @param body Time series points and period if needed. Advanced model parameters can also be set in
* the request.
* This operation sends a sequence of telemetry events that will be monitored by Azure Monitor.
* @param body The list of telemetry events to track.
* @param options The options parameters.
*/
track(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export interface TelemetryItem {
/**
* 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.
*/
time: Date;
time: string;
/**
* Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.
*/
Expand Down Expand Up @@ -65,9 +65,13 @@ export interface MonitorBase {
*/
export interface MonitorDomain {
/**
* Ignored value.
* Describes unknown properties. The value of an unknown property can be of "any" type.
*/
test?: string;
[property: string]: any;
/**
* Schema version
*/
version: number;
}

/**
Expand Down Expand Up @@ -205,10 +209,6 @@ export interface StackFrame {
* Instances of AvailabilityData represent the result of executing an availability test.
*/
export type AvailabilityData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service.
*/
Expand Down Expand Up @@ -247,10 +247,6 @@ export type AvailabilityData = MonitorDomain & {
* 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.
*/
export type TelemetryEventData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Event name. Keep it low cardinality to allow proper grouping and useful metrics.
*/
Expand All @@ -269,14 +265,10 @@ export type TelemetryEventData = MonitorDomain & {
* An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.
*/
export type TelemetryExceptionData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Exception chain - list of inner exceptions.
*/
exceptions?: TelemetryExceptionDetails[];
exceptions: TelemetryExceptionDetails[];
/**
* Severity level. Mostly used to indicate exception severity level when it is reported by logging library.
*/
Expand All @@ -296,13 +288,9 @@ export type TelemetryExceptionData = MonitorDomain & {
};

/**
* 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.
* 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.
*/
export type MessageData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Trace message
*/
Expand All @@ -325,10 +313,6 @@ export type MessageData = MonitorDomain & {
* An instance of the Metric item is a list of measurements (single data points) and/or aggregations.
*/
export type MetricsData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* 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.
*/
Expand All @@ -343,10 +327,6 @@ export type MetricsData = MonitorDomain & {
* An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.
*/
export type PageViewData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Identifier of a page view instance. Used for correlation between page view and other telemetry items.
*/
Expand Down Expand Up @@ -381,10 +361,6 @@ export type PageViewData = MonitorDomain & {
* 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.
*/
export type PageViewPerfData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Identifier of a page view instance. Used for correlation between page view and other telemetry items.
*/
Expand Down Expand Up @@ -435,10 +411,6 @@ export type PageViewPerfData = MonitorDomain & {
* An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint.
*/
export type RemoteDependencyData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call.
*/
Expand All @@ -452,7 +424,7 @@ export type RemoteDependencyData = MonitorDomain & {
*/
resultCode?: string;
/**
* Command initiated by this dependency call. Examples are SQL statement and HTTP URL's with all query parameters.
* Command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters.
*/
data?: string;
/**
Expand All @@ -468,7 +440,7 @@ export type RemoteDependencyData = MonitorDomain & {
*/
duration: string;
/**
* Indication of successfull or unsuccessfull call.
* Indication of successful or unsuccessful call.
*/
success?: boolean;
/**
Expand All @@ -482,13 +454,9 @@ export type RemoteDependencyData = MonitorDomain & {
};

/**
* An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.
* 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.
*/
export type RequestData = MonitorDomain & {
/**
* Schema version
*/
version: number;
/**
* Identifier of a request call instance. Used for correlation between request and other telemetry items.
*/
Expand All @@ -502,7 +470,7 @@ export type RequestData = MonitorDomain & {
*/
duration: string;
/**
* Indication of successfull or unsuccessfull call.
* Indication of successful or unsuccessful call.
*/
success: boolean;
/**
Expand Down
Loading

0 comments on commit 5a4d307

Please sign in to comment.