Skip to content

Commit 5a4d307

Browse files
markwolffxirzec
andauthored
[Monitor][Codegen] Use generated TelemetryItem (as Envelope) (Azure#11280)
* 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 <[email protected]> * refactor spanUtils envelope creation Co-authored-by: Jeff Fisher <[email protected]>
1 parent 7de0532 commit 5a4d307

File tree

21 files changed

+226
-366
lines changed

21 files changed

+226
-366
lines changed

sdk/monitor/monitor-opentelemetry-exporter/src/Declarations/Contracts/Generated/Envelope.ts

Lines changed: 0 additions & 55 deletions
This file was deleted.

sdk/monitor/monitor-opentelemetry-exporter/src/Declarations/Contracts/Generated/index.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,3 @@ export import Base = require("./Base");
44
export import ContextTagKeys = require("./ContextTagKeys");
55
export import Data = require("./Data");
66
export import Domain = require("./Domain");
7-
export import Envelope = require("./Envelope");

sdk/monitor/monitor-opentelemetry-exporter/src/export/exporter.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33

44
import { Logger } from "@opentelemetry/api";
55
import { ConsoleLogger, LogLevel, ExportResult } from "@opentelemetry/core";
6-
import { Envelope } from "../Declarations/Contracts";
76
import { ConnectionStringParser } from "../utils/connectionStringParser";
87
import { HttpSender, FileSystemPersist } from "../platform";
98
import { DEFAULT_EXPORTER_CONFIG, AzureExporterConfig } from "../config";
109
import { BaseExporter, TelemetryProcessor, PersistentStorage, Sender } from "../types";
1110
import { isRetriable, BreezeResponse } from "../utils/breezeUtils";
1211
import { ENV_CONNECTION_STRING, ENV_INSTRUMENTATION_KEY } from "../Declarations/Constants";
12+
import { TelemetryItem as Envelope } from "../generated";
1313

1414
export abstract class AzureMonitorBaseExporter implements BaseExporter {
1515
protected readonly _persister: PersistentStorage;

sdk/monitor/monitor-opentelemetry-exporter/src/generated/applicationInsightsClient.ts

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,8 @@ export class ApplicationInsightsClient extends ApplicationInsightsClientContext
2626
}
2727

2828
/**
29-
* This operation generates a model using an entire series, each point is detected with the same model.
30-
* With this method, points before and after a certain point are used to determine whether it is an
31-
* anomaly. The entire detection can give user an overall status of the time series.
32-
* @param body Time series points and period if needed. Advanced model parameters can also be set in
33-
* the request.
29+
* This operation sends a sequence of telemetry events that will be monitored by Azure Monitor.
30+
* @param body The list of telemetry events to track.
3431
* @param options The options parameters.
3532
*/
3633
track(

sdk/monitor/monitor-opentelemetry-exporter/src/generated/models/index.ts

Lines changed: 13 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ export interface TelemetryItem {
2323
/**
2424
* 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.
2525
*/
26-
time: Date;
26+
time: string;
2727
/**
2828
* Sampling rate used in application. This telemetry item represents 1 / sampleRate actual telemetry items.
2929
*/
@@ -65,9 +65,13 @@ export interface MonitorBase {
6565
*/
6666
export interface MonitorDomain {
6767
/**
68-
* Ignored value.
68+
* Describes unknown properties. The value of an unknown property can be of "any" type.
6969
*/
70-
test?: string;
70+
[property: string]: any;
71+
/**
72+
* Schema version
73+
*/
74+
version: number;
7175
}
7276

7377
/**
@@ -205,10 +209,6 @@ export interface StackFrame {
205209
* Instances of AvailabilityData represent the result of executing an availability test.
206210
*/
207211
export type AvailabilityData = MonitorDomain & {
208-
/**
209-
* Schema version
210-
*/
211-
version: number;
212212
/**
213213
* Identifier of a test run. Use it to correlate steps of test run and telemetry generated by the service.
214214
*/
@@ -247,10 +247,6 @@ export type AvailabilityData = MonitorDomain & {
247247
* 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.
248248
*/
249249
export type TelemetryEventData = MonitorDomain & {
250-
/**
251-
* Schema version
252-
*/
253-
version: number;
254250
/**
255251
* Event name. Keep it low cardinality to allow proper grouping and useful metrics.
256252
*/
@@ -269,14 +265,10 @@ export type TelemetryEventData = MonitorDomain & {
269265
* An instance of Exception represents a handled or unhandled exception that occurred during execution of the monitored application.
270266
*/
271267
export type TelemetryExceptionData = MonitorDomain & {
272-
/**
273-
* Schema version
274-
*/
275-
version: number;
276268
/**
277269
* Exception chain - list of inner exceptions.
278270
*/
279-
exceptions?: TelemetryExceptionDetails[];
271+
exceptions: TelemetryExceptionDetails[];
280272
/**
281273
* Severity level. Mostly used to indicate exception severity level when it is reported by logging library.
282274
*/
@@ -296,13 +288,9 @@ export type TelemetryExceptionData = MonitorDomain & {
296288
};
297289

298290
/**
299-
* 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.
291+
* 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.
300292
*/
301293
export type MessageData = MonitorDomain & {
302-
/**
303-
* Schema version
304-
*/
305-
version: number;
306294
/**
307295
* Trace message
308296
*/
@@ -325,10 +313,6 @@ export type MessageData = MonitorDomain & {
325313
* An instance of the Metric item is a list of measurements (single data points) and/or aggregations.
326314
*/
327315
export type MetricsData = MonitorDomain & {
328-
/**
329-
* Schema version
330-
*/
331-
version: number;
332316
/**
333317
* 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.
334318
*/
@@ -343,10 +327,6 @@ export type MetricsData = MonitorDomain & {
343327
* An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.
344328
*/
345329
export type PageViewData = MonitorDomain & {
346-
/**
347-
* Schema version
348-
*/
349-
version: number;
350330
/**
351331
* Identifier of a page view instance. Used for correlation between page view and other telemetry items.
352332
*/
@@ -381,10 +361,6 @@ export type PageViewData = MonitorDomain & {
381361
* 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.
382362
*/
383363
export type PageViewPerfData = MonitorDomain & {
384-
/**
385-
* Schema version
386-
*/
387-
version: number;
388364
/**
389365
* Identifier of a page view instance. Used for correlation between page view and other telemetry items.
390366
*/
@@ -435,10 +411,6 @@ export type PageViewPerfData = MonitorDomain & {
435411
* An instance of Remote Dependency represents an interaction of the monitored component with a remote component/service like SQL or an HTTP endpoint.
436412
*/
437413
export type RemoteDependencyData = MonitorDomain & {
438-
/**
439-
* Schema version
440-
*/
441-
version: number;
442414
/**
443415
* Identifier of a dependency call instance. Used for correlation with the request telemetry item corresponding to this dependency call.
444416
*/
@@ -452,7 +424,7 @@ export type RemoteDependencyData = MonitorDomain & {
452424
*/
453425
resultCode?: string;
454426
/**
455-
* Command initiated by this dependency call. Examples are SQL statement and HTTP URL's with all query parameters.
427+
* Command initiated by this dependency call. Examples are SQL statement and HTTP URL with all query parameters.
456428
*/
457429
data?: string;
458430
/**
@@ -468,7 +440,7 @@ export type RemoteDependencyData = MonitorDomain & {
468440
*/
469441
duration: string;
470442
/**
471-
* Indication of successfull or unsuccessfull call.
443+
* Indication of successful or unsuccessful call.
472444
*/
473445
success?: boolean;
474446
/**
@@ -482,13 +454,9 @@ export type RemoteDependencyData = MonitorDomain & {
482454
};
483455

484456
/**
485-
* An instance of PageView represents a generic action on a page like a button click. It is also the base type for PageView.
457+
* 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.
486458
*/
487459
export type RequestData = MonitorDomain & {
488-
/**
489-
* Schema version
490-
*/
491-
version: number;
492460
/**
493461
* Identifier of a request call instance. Used for correlation between request and other telemetry items.
494462
*/
@@ -502,7 +470,7 @@ export type RequestData = MonitorDomain & {
502470
*/
503471
duration: string;
504472
/**
505-
* Indication of successfull or unsuccessfull call.
473+
* Indication of successful or unsuccessful call.
506474
*/
507475
success: boolean;
508476
/**

0 commit comments

Comments
 (0)