@arms/rum-core
Advanced tools
Comparing version 0.0.5 to 0.0.7
import Client from './model/client'; | ||
import Context from './model/context'; | ||
import Reporter from './model/reporter'; | ||
import Shell from './model/shell'; | ||
export * from './types/client'; | ||
@@ -16,2 +17,2 @@ export * from './types/collector'; | ||
export * from './utils/trace'; | ||
export { Client, Context, Reporter }; | ||
export { Client, Context, Reporter, Shell }; |
@@ -8,3 +8,4 @@ "use strict"; | ||
Context: true, | ||
Reporter: true | ||
Reporter: true, | ||
Shell: true | ||
}; | ||
@@ -17,2 +18,4 @@ var _client = _interopRequireDefault(require("./model/client")); | ||
exports.Reporter = _reporter["default"]; | ||
var _shell = _interopRequireDefault(require("./model/shell")); | ||
exports.Shell = _shell["default"]; | ||
var _client2 = require("./types/client"); | ||
@@ -53,8 +56,8 @@ Object.keys(_client2).forEach(function (key) { | ||
}); | ||
var _shell = require("./types/shell"); | ||
Object.keys(_shell).forEach(function (key) { | ||
var _shell2 = require("./types/shell"); | ||
Object.keys(_shell2).forEach(function (key) { | ||
if (key === "default" || key === "__esModule") return; | ||
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return; | ||
if (key in exports && exports[key] === _shell[key]) return; | ||
exports[key] = _shell[key]; | ||
if (key in exports && exports[key] === _shell2[key]) return; | ||
exports[key] = _shell2[key]; | ||
}); | ||
@@ -61,0 +64,0 @@ var _base = require("./utils/base"); |
@@ -1,3 +0,3 @@ | ||
import { IConfiguration, IContext, IViewData } from "../types/client"; | ||
import { RumEvent } from "../types/rum-event"; | ||
import { IConfiguration, IContext } from "../types/client"; | ||
import { RumEvent, IViewData } from "../types/rum-event"; | ||
declare class Context implements IContext { | ||
@@ -4,0 +4,0 @@ private config; |
@@ -1,3 +0,3 @@ | ||
import { IContext, IViewData } from '../types/client'; | ||
import { RumEvent } from '../types/rum-event'; | ||
import { IContext } from '../types/client'; | ||
import { RumEvent, IViewData } from '../types/rum-event'; | ||
export default abstract class Reporter { | ||
@@ -4,0 +4,0 @@ name: string; |
@@ -7,2 +7,3 @@ "use strict"; | ||
var _exception = require("../utils/exception"); | ||
// import { IReporter } from '../types/reporter'; | ||
var Reporter = exports["default"] = /*#__PURE__*/function () { | ||
@@ -9,0 +10,0 @@ function Reporter() { |
import { ICollector } from './collector'; | ||
import { IProcessor } from './processor'; | ||
import { IReporter } from './reporter'; | ||
import { RumEvent, RumEventBundle } from './rum-event'; | ||
import { RumEvent, RumEventBundle, IViewData } from './rum-event'; | ||
import { ITracingOption } from '../utils/trace'; | ||
@@ -12,6 +12,2 @@ export declare enum EventType { | ||
} | ||
export interface IViewData { | ||
id: string; | ||
name: string; | ||
} | ||
export interface IContext { | ||
@@ -18,0 +14,0 @@ /** |
@@ -1,3 +0,3 @@ | ||
import { IContext, IViewData } from './client'; | ||
import { RumEvent } from './rum-event'; | ||
import { IContext } from './client'; | ||
import { RumEvent, IViewData } from './rum-event'; | ||
export interface IReporter { | ||
@@ -4,0 +4,0 @@ name: string; |
@@ -9,18 +9,18 @@ export declare enum RumEventType { | ||
} | ||
export type BaseObjectKey = string | number; | ||
export type BaseObjectPrimitiveValue = string | number | boolean | null | undefined; | ||
export type BaseObjectValue = BaseObjectPrimitiveValue | BaseObject | BaseObjectPrimitiveValue[]; | ||
export interface BaseObject { | ||
[key: BaseObjectKey]: BaseObjectValue; | ||
[key: string]: BaseObjectValue; | ||
} | ||
export interface IViewData { | ||
id: string; | ||
name: string; | ||
} | ||
export type BaseObjectPrimitiveValue = string | number | boolean | null | undefined; | ||
export type BaseObjectValue = BaseObjectPrimitiveValue | BaseObject | BaseObjectPrimitiveValue[] | IViewData; | ||
export interface RumBaseEvent { | ||
event_type: RumEventType; | ||
event_type?: RumEventType; | ||
event_id?: string; | ||
timestamp?: number; | ||
times?: number; | ||
view?: { | ||
id: string; | ||
name: string; | ||
}; | ||
[key: `$attr.${string}`]: BaseObjectValue; | ||
view?: IViewData; | ||
[key: string]: BaseObjectValue; | ||
} | ||
@@ -38,2 +38,3 @@ export interface RumViewEvent extends RumBaseEvent { | ||
dom_complete?: number; | ||
load_event?: number; | ||
referrer?: string; | ||
@@ -61,3 +62,3 @@ url?: string; | ||
url: string; | ||
timing_data?: PerformanceResourceTiming; | ||
timing_data?: string; | ||
} | ||
@@ -91,9 +92,10 @@ export interface RumExceptionEvent extends RumBaseEvent { | ||
export interface RumCustomEvent extends RumBaseEvent { | ||
id: string; | ||
type: string; | ||
[key: BaseObjectKey]: BaseObjectValue; | ||
name: string; | ||
group?: string; | ||
value: number; | ||
} | ||
export type RumEvent = RumViewEvent | RumResourceEvent | RumExceptionEvent | RumActionEvent | RumCustomEvent; | ||
export declare enum AppType { | ||
broswer = "browser", | ||
browser = "browser", | ||
miniapp = "miniapp" | ||
@@ -100,0 +102,0 @@ } |
@@ -15,5 +15,5 @@ "use strict"; | ||
var AppType = exports.AppType = /*#__PURE__*/function (AppType) { | ||
AppType["broswer"] = "browser"; | ||
AppType["browser"] = "browser"; | ||
AppType["miniapp"] = "miniapp"; | ||
return AppType; | ||
}({}); |
@@ -7,2 +7,8 @@ import { MatchOption } from "./match"; | ||
}; | ||
export type Baggage = { | ||
appType?: string; | ||
pid?: string; | ||
uid?: string; | ||
sid?: string; | ||
}; | ||
export declare function isTraceOption(option: any): option is TraceOption; | ||
@@ -13,3 +19,3 @@ export interface ITracingOption { | ||
allowedUrls?: Array<MatchOption | TraceOption> | undefined; | ||
tracestate?: boolean; | ||
baggage?: boolean; | ||
} | ||
@@ -21,3 +27,3 @@ export declare function generateTraceId(): any; | ||
} | ||
export declare function makeTracingHeaders(traceId: string, spanId: string, sampled: boolean, propagatorTypes: PropagatorType[], tracestate?: string): ITracingHeaders; | ||
export declare function makeTracingHeaders(traceId: string, spanId: string, sampled: boolean, propagatorTypes: PropagatorType[], baggage?: Baggage): ITracingHeaders; | ||
export declare function parseTracingOptions(tracingOption: boolean | ITracingOption): ITracingOption; |
@@ -41,16 +41,3 @@ "use strict"; | ||
} | ||
// export function getB3Header(traceId: string, spanId: string) { | ||
// return `${traceId}-${spanId}-1` | ||
// } | ||
// | ||
// export function getW3CTraceHeader(traceId: string, spanId: string) { | ||
// return `00-${traceId}-${spanId}-01` | ||
// } | ||
// | ||
// export function getJaegerTraceHeader(traceId: string, spanId: string) { | ||
// return `${traceId}:${spanId}:0:1` | ||
// } | ||
function makeTracingHeaders(traceId, spanId, sampled, propagatorTypes, tracestate) { | ||
function makeTracingHeaders(traceId, spanId, sampled, propagatorTypes, baggage) { | ||
var tracingHeaders = {}; | ||
@@ -75,8 +62,12 @@ var sample = sampled ? '1' : '0'; | ||
tracingHeaders['traceparent'] = "00-" + traceId + "-" + spanId + "-0" + sample; | ||
if (tracestate) { | ||
tracingHeaders['tracestate'] = tracestate; | ||
} | ||
break; | ||
} | ||
}); | ||
if (baggage) { | ||
var bagValList = ['rum=v2']; | ||
Object.keys(baggage).forEach(function (key) { | ||
bagValList.push(key + "=" + baggage[key]); | ||
}); | ||
bagValList.length && (tracingHeaders['baggage'] = bagValList.join(',')); | ||
} | ||
return tracingHeaders; | ||
@@ -90,3 +81,3 @@ } | ||
allowedUrls: [], | ||
tracestate: true | ||
baggage: true | ||
}; | ||
@@ -100,4 +91,4 @@ } | ||
allowedUrls = _tracingOption$allowe === void 0 ? [] : _tracingOption$allowe, | ||
_tracingOption$traces = tracingOption.tracestate, | ||
tracestate = _tracingOption$traces === void 0 ? true : _tracingOption$traces; | ||
_tracingOption$baggag = tracingOption.baggage, | ||
baggage = _tracingOption$baggag === void 0 ? true : _tracingOption$baggag; | ||
var traceOptions = []; | ||
@@ -120,4 +111,4 @@ if ((0, _is.isArray)(allowedUrls) && allowedUrls.length) { | ||
allowedUrls: traceOptions, | ||
tracestate: tracestate | ||
baggage: baggage | ||
}; | ||
} |
{ | ||
"name": "@arms/rum-core", | ||
"version": "0.0.5", | ||
"version": "0.0.7", | ||
"description": "arms rum javascript sdk core", | ||
@@ -5,0 +5,0 @@ "author": "guangli.fj <guangli.fj@alibaba-inc.com>", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
38818
39
1144