@benzenejs/mesh-reporting 0.0.0-stage → 0.1.0-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Extensions.d.ts +20 -0
- package/dist/Extensions.js +36 -0
- package/dist/HttpMeshReportPublisher.d.ts +19 -0
- package/dist/HttpMeshReportPublisher.js +31 -0
- package/dist/MeshReportingOptions.d.ts +7 -0
- package/dist/MeshReportingOptions.js +13 -0
- package/dist/MeshSelfReportMiddleware.d.ts +23 -0
- package/dist/MeshSelfReportMiddleware.js +68 -0
- package/dist/MeshSelfReportOptions.d.ts +26 -0
- package/dist/MeshSelfReportOptions.js +33 -0
- package/dist/MeshSelfReportState.d.ts +14 -0
- package/dist/MeshSelfReportState.js +18 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +28 -0
- package/package.json +16 -4
- package/README.md +0 -3
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/** Port of Benzene.Mesh.Reporting.Extensions. */
|
|
2
|
+
import { IBenzeneServiceContainer } from '@benzenejs/abstractions';
|
|
3
|
+
import { IMiddlewarePipelineBuilder } from '@benzenejs/abstractions-middleware';
|
|
4
|
+
import { MeshReportingOptions } from './MeshReportingOptions';
|
|
5
|
+
import { MeshSelfReportOptions } from './MeshSelfReportOptions';
|
|
6
|
+
/**
|
|
7
|
+
* Registers `HttpMeshReportPublisher` (as `IMeshReportPublisher`) against the given options - for a reporting
|
|
8
|
+
* service that isn't colocated with the aggregator's own storage. C# extension method -> free function.
|
|
9
|
+
*/
|
|
10
|
+
export declare function addMeshHttpReporting(services: IBenzeneServiceContainer, options: MeshReportingOptions): IBenzeneServiceContainer;
|
|
11
|
+
/**
|
|
12
|
+
* Registers `MeshSelfReportOptions` and the singleton `MeshSelfReportState` the self-report middleware needs.
|
|
13
|
+
* Requires an `IMeshReportPublisher` already registered (via {@link addMeshHttpReporting} or the aggregator).
|
|
14
|
+
*/
|
|
15
|
+
export declare function addMeshSelfReport(services: IBenzeneServiceContainer, options: MeshSelfReportOptions): IBenzeneServiceContainer;
|
|
16
|
+
/**
|
|
17
|
+
* Adds `MeshSelfReportMiddleware` to the pipeline. Requires {@link addMeshSelfReport} (and an
|
|
18
|
+
* `IMeshReportPublisher` registration) already called on the same container.
|
|
19
|
+
*/
|
|
20
|
+
export declare function useMeshSelfReport<TContext>(app: IMiddlewarePipelineBuilder<TContext>): IMiddlewarePipelineBuilder<TContext>;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.addMeshHttpReporting = addMeshHttpReporting;
|
|
4
|
+
exports.addMeshSelfReport = addMeshSelfReport;
|
|
5
|
+
exports.useMeshSelfReport = useMeshSelfReport;
|
|
6
|
+
const mesh_contracts_1 = require("@benzenejs/mesh-contracts");
|
|
7
|
+
const HttpMeshReportPublisher_1 = require("./HttpMeshReportPublisher");
|
|
8
|
+
const MeshReportingOptions_1 = require("./MeshReportingOptions");
|
|
9
|
+
const MeshSelfReportMiddleware_1 = require("./MeshSelfReportMiddleware");
|
|
10
|
+
const MeshSelfReportOptions_1 = require("./MeshSelfReportOptions");
|
|
11
|
+
const MeshSelfReportState_1 = require("./MeshSelfReportState");
|
|
12
|
+
/**
|
|
13
|
+
* Registers `HttpMeshReportPublisher` (as `IMeshReportPublisher`) against the given options - for a reporting
|
|
14
|
+
* service that isn't colocated with the aggregator's own storage. C# extension method -> free function.
|
|
15
|
+
*/
|
|
16
|
+
function addMeshHttpReporting(services, options) {
|
|
17
|
+
services.addSingletonInstance(MeshReportingOptions_1.MeshReportingOptions, options);
|
|
18
|
+
services.addSingletonFactory(mesh_contracts_1.IMeshReportPublisher, (resolver) => new HttpMeshReportPublisher_1.HttpMeshReportPublisher(resolver.getService(MeshReportingOptions_1.MeshReportingOptions)));
|
|
19
|
+
return services;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Registers `MeshSelfReportOptions` and the singleton `MeshSelfReportState` the self-report middleware needs.
|
|
23
|
+
* Requires an `IMeshReportPublisher` already registered (via {@link addMeshHttpReporting} or the aggregator).
|
|
24
|
+
*/
|
|
25
|
+
function addMeshSelfReport(services, options) {
|
|
26
|
+
services.addSingletonInstance(MeshSelfReportOptions_1.MeshSelfReportOptions, options);
|
|
27
|
+
services.addSingletonFactory(MeshSelfReportState_1.MeshSelfReportState, () => new MeshSelfReportState_1.MeshSelfReportState());
|
|
28
|
+
return services;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Adds `MeshSelfReportMiddleware` to the pipeline. Requires {@link addMeshSelfReport} (and an
|
|
32
|
+
* `IMeshReportPublisher` registration) already called on the same container.
|
|
33
|
+
*/
|
|
34
|
+
function useMeshSelfReport(app) {
|
|
35
|
+
return app.use((resolver) => new MeshSelfReportMiddleware_1.MeshSelfReportMiddleware(resolver.getService(mesh_contracts_1.IMeshReportPublisher), resolver.getService(MeshSelfReportOptions_1.MeshSelfReportOptions), resolver.getService(MeshSelfReportState_1.MeshSelfReportState)));
|
|
36
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** Port of Benzene.Mesh.Reporting.HttpMeshReportPublisher. */
|
|
2
|
+
import { IMeshReportPublisher, MeshServiceReport } from '@benzenejs/mesh-contracts';
|
|
3
|
+
import { MeshReportingOptions } from './MeshReportingOptions';
|
|
4
|
+
/** A `fetch`-like function - the port of C# `HttpClient.PostAsync` (`HttpClient` -> injectable `fetch`). */
|
|
5
|
+
export type ReportFetch = (url: string, init: RequestInit) => Promise<Response>;
|
|
6
|
+
/**
|
|
7
|
+
* The HTTP-ingestion `IMeshReportPublisher` - POSTs the report as JSON to `MeshReportingOptions.ingestionUrl`
|
|
8
|
+
* (an aggregator's ingestion endpoint), for a reporter that isn't colocated with the aggregator's storage.
|
|
9
|
+
*
|
|
10
|
+
* `HttpClient` -> an injectable `fetch` (default global `fetch`, the `@benzenejs/health-checks-http` pattern);
|
|
11
|
+
* `EnsureSuccessStatusCode` -> throw on a non-2xx response. The report's fields are already camelCase, so
|
|
12
|
+
* `JSON.stringify` matches C#'s camelCase `JsonSerializerOptions`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class HttpMeshReportPublisher implements IMeshReportPublisher {
|
|
15
|
+
private readonly options;
|
|
16
|
+
private readonly fetchFn;
|
|
17
|
+
constructor(options: MeshReportingOptions, fetchFn?: ReportFetch);
|
|
18
|
+
publishAsync(report: MeshServiceReport): Promise<void>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.HttpMeshReportPublisher = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* The HTTP-ingestion `IMeshReportPublisher` - POSTs the report as JSON to `MeshReportingOptions.ingestionUrl`
|
|
6
|
+
* (an aggregator's ingestion endpoint), for a reporter that isn't colocated with the aggregator's storage.
|
|
7
|
+
*
|
|
8
|
+
* `HttpClient` -> an injectable `fetch` (default global `fetch`, the `@benzenejs/health-checks-http` pattern);
|
|
9
|
+
* `EnsureSuccessStatusCode` -> throw on a non-2xx response. The report's fields are already camelCase, so
|
|
10
|
+
* `JSON.stringify` matches C#'s camelCase `JsonSerializerOptions`.
|
|
11
|
+
*/
|
|
12
|
+
class HttpMeshReportPublisher {
|
|
13
|
+
options;
|
|
14
|
+
fetchFn;
|
|
15
|
+
constructor(options, fetchFn = fetch) {
|
|
16
|
+
this.options = options;
|
|
17
|
+
this.fetchFn = fetchFn;
|
|
18
|
+
}
|
|
19
|
+
async publishAsync(report) {
|
|
20
|
+
const json = JSON.stringify(report);
|
|
21
|
+
const response = await this.fetchFn(this.options.ingestionUrl, {
|
|
22
|
+
method: 'POST',
|
|
23
|
+
headers: { 'content-type': 'application/json' },
|
|
24
|
+
body: json,
|
|
25
|
+
});
|
|
26
|
+
if (!response.ok) {
|
|
27
|
+
throw new Error(`Mesh report POST to ${this.options.ingestionUrl} failed with status ${response.status}.`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
exports.HttpMeshReportPublisher = HttpMeshReportPublisher;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/** Port of Benzene.Mesh.Reporting.MeshReportingOptions. */
|
|
2
|
+
/** Configures where `HttpMeshReportPublisher` posts self-reports. Resolved from the container by its class. */
|
|
3
|
+
export declare class MeshReportingOptions {
|
|
4
|
+
readonly ingestionUrl: string;
|
|
5
|
+
/** @param ingestionUrl The aggregator's ingestion endpoint (e.g. `https://mesh.internal/mesh/report`). */
|
|
6
|
+
constructor(ingestionUrl: string);
|
|
7
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Port of Benzene.Mesh.Reporting.MeshReportingOptions. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MeshReportingOptions = void 0;
|
|
5
|
+
/** Configures where `HttpMeshReportPublisher` posts self-reports. Resolved from the container by its class. */
|
|
6
|
+
class MeshReportingOptions {
|
|
7
|
+
ingestionUrl;
|
|
8
|
+
/** @param ingestionUrl The aggregator's ingestion endpoint (e.g. `https://mesh.internal/mesh/report`). */
|
|
9
|
+
constructor(ingestionUrl) {
|
|
10
|
+
this.ingestionUrl = ingestionUrl;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
exports.MeshReportingOptions = MeshReportingOptions;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/** Port of Benzene.Mesh.Reporting.MeshSelfReportMiddleware. */
|
|
2
|
+
import { IMiddleware, NextFunc } from '@benzenejs/abstractions-middleware';
|
|
3
|
+
import { IMeshReportPublisher } from '@benzenejs/mesh-contracts';
|
|
4
|
+
import { MeshSelfReportOptions } from './MeshSelfReportOptions';
|
|
5
|
+
import { MeshSelfReportState } from './MeshSelfReportState';
|
|
6
|
+
/**
|
|
7
|
+
* After a real request/message completes, opportunistically publishes this service's current spec/health via
|
|
8
|
+
* the injected `IMeshReportPublisher` - piggybacking on real traffic rather than a dedicated scheduled
|
|
9
|
+
* reporter. Throttled by `MeshSelfReportOptions.minimumIntervalMs` (tracked in `MeshSelfReportState`).
|
|
10
|
+
*
|
|
11
|
+
* Publishing is fire-and-forget and fully best-effort: it never delays the wrapped response, and a publish
|
|
12
|
+
* failure (or a provider throwing) is swallowed - side-channel telemetry, not part of the primary path.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MeshSelfReportMiddleware<TContext> implements IMiddleware<TContext> {
|
|
15
|
+
private readonly publisher;
|
|
16
|
+
private readonly options;
|
|
17
|
+
private readonly state;
|
|
18
|
+
constructor(publisher: IMeshReportPublisher, options: MeshSelfReportOptions, state: MeshSelfReportState);
|
|
19
|
+
get name(): string;
|
|
20
|
+
handleAsync(context: TContext, next: NextFunc): Promise<void>;
|
|
21
|
+
private shouldPublish;
|
|
22
|
+
private publishBestEffortAsync;
|
|
23
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeshSelfReportMiddleware = void 0;
|
|
4
|
+
const mesh_contracts_1 = require("@benzenejs/mesh-contracts");
|
|
5
|
+
/**
|
|
6
|
+
* After a real request/message completes, opportunistically publishes this service's current spec/health via
|
|
7
|
+
* the injected `IMeshReportPublisher` - piggybacking on real traffic rather than a dedicated scheduled
|
|
8
|
+
* reporter. Throttled by `MeshSelfReportOptions.minimumIntervalMs` (tracked in `MeshSelfReportState`).
|
|
9
|
+
*
|
|
10
|
+
* Publishing is fire-and-forget and fully best-effort: it never delays the wrapped response, and a publish
|
|
11
|
+
* failure (or a provider throwing) is swallowed - side-channel telemetry, not part of the primary path.
|
|
12
|
+
*/
|
|
13
|
+
class MeshSelfReportMiddleware {
|
|
14
|
+
publisher;
|
|
15
|
+
options;
|
|
16
|
+
state;
|
|
17
|
+
constructor(publisher, options, state) {
|
|
18
|
+
this.publisher = publisher;
|
|
19
|
+
this.options = options;
|
|
20
|
+
this.state = state;
|
|
21
|
+
}
|
|
22
|
+
get name() {
|
|
23
|
+
return 'MeshSelfReport';
|
|
24
|
+
}
|
|
25
|
+
async handleAsync(context, next) {
|
|
26
|
+
await next();
|
|
27
|
+
if (this.shouldPublish()) {
|
|
28
|
+
// Fire-and-forget: not awaited, so the wrapped response is never delayed. Errors are handled inside.
|
|
29
|
+
void this.publishBestEffortAsync();
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
shouldPublish() {
|
|
33
|
+
const last = this.state.lastPublishedAtUtc;
|
|
34
|
+
return last === undefined || Date.now() - last >= this.options.minimumIntervalMs;
|
|
35
|
+
}
|
|
36
|
+
async publishBestEffortAsync() {
|
|
37
|
+
// Set before attempting the publish, not after - so a burst of concurrent requests don't all see "no
|
|
38
|
+
// recent publish" and race. A failed attempt still counts toward the throttle window, deliberately.
|
|
39
|
+
this.state.lastPublishedAtUtc = Date.now();
|
|
40
|
+
try {
|
|
41
|
+
let specJson;
|
|
42
|
+
let health;
|
|
43
|
+
let error;
|
|
44
|
+
try {
|
|
45
|
+
specJson = await this.options.specProvider();
|
|
46
|
+
}
|
|
47
|
+
catch (ex) {
|
|
48
|
+
error = errorName(ex);
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
health = await this.options.healthProvider();
|
|
52
|
+
}
|
|
53
|
+
catch (ex) {
|
|
54
|
+
error ??= errorName(ex);
|
|
55
|
+
}
|
|
56
|
+
const report = new mesh_contracts_1.MeshServiceReport(this.options.serviceName, Date.now(), specJson, health, error);
|
|
57
|
+
await this.publisher.publishAsync(report);
|
|
58
|
+
}
|
|
59
|
+
catch {
|
|
60
|
+
// Best-effort side-channel telemetry - a publish failure must never affect the primary path.
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.MeshSelfReportMiddleware = MeshSelfReportMiddleware;
|
|
65
|
+
/** Mirrors C#'s `ex.GetType().Name`. */
|
|
66
|
+
function errorName(ex) {
|
|
67
|
+
return ex instanceof Error ? ex.name : typeof ex;
|
|
68
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/** Port of Benzene.Mesh.Reporting.MeshSelfReportOptions. */
|
|
2
|
+
import { HealthCheckResponse } from '@benzenejs/health-checks-core';
|
|
3
|
+
/** Default minimum interval between opportunistic publishes: 5 minutes, in milliseconds. */
|
|
4
|
+
export declare const DefaultMinimumIntervalMs: number;
|
|
5
|
+
/**
|
|
6
|
+
* Configures `MeshSelfReportMiddleware` - how to name this service, how to obtain its own current
|
|
7
|
+
* spec/health on demand, and how often that's allowed to happen. The spec/health providers are delegates
|
|
8
|
+
* (a self-reporting service already knows how to produce both), keeping this package free of a dependency
|
|
9
|
+
* on the spec/health generators.
|
|
10
|
+
*
|
|
11
|
+
* `Func<Task<string?>>`/`Func<Task<HealthCheckResponse?>>` -> `() => Promise<... | undefined>`; `TimeSpan`
|
|
12
|
+
* -> millisecond `number`.
|
|
13
|
+
*/
|
|
14
|
+
export declare class MeshSelfReportOptions {
|
|
15
|
+
readonly serviceName: string;
|
|
16
|
+
readonly specProvider: () => Promise<string | undefined>;
|
|
17
|
+
readonly healthProvider: () => Promise<HealthCheckResponse | undefined>;
|
|
18
|
+
readonly minimumIntervalMs: number;
|
|
19
|
+
/**
|
|
20
|
+
* @param serviceName This service's name (matches its registry entry's `name`).
|
|
21
|
+
* @param specProvider Produces this service's current spec document, verbatim, or `undefined` if unavailable.
|
|
22
|
+
* @param healthProvider Produces this service's current aggregated health response, or `undefined` if unavailable.
|
|
23
|
+
* @param minimumIntervalMs Minimum time between opportunistic publishes (ms). Defaults to 5 minutes.
|
|
24
|
+
*/
|
|
25
|
+
constructor(serviceName: string, specProvider: () => Promise<string | undefined>, healthProvider: () => Promise<HealthCheckResponse | undefined>, minimumIntervalMs?: number);
|
|
26
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MeshSelfReportOptions = exports.DefaultMinimumIntervalMs = void 0;
|
|
4
|
+
/** Default minimum interval between opportunistic publishes: 5 minutes, in milliseconds. */
|
|
5
|
+
exports.DefaultMinimumIntervalMs = 5 * 60 * 1000;
|
|
6
|
+
/**
|
|
7
|
+
* Configures `MeshSelfReportMiddleware` - how to name this service, how to obtain its own current
|
|
8
|
+
* spec/health on demand, and how often that's allowed to happen. The spec/health providers are delegates
|
|
9
|
+
* (a self-reporting service already knows how to produce both), keeping this package free of a dependency
|
|
10
|
+
* on the spec/health generators.
|
|
11
|
+
*
|
|
12
|
+
* `Func<Task<string?>>`/`Func<Task<HealthCheckResponse?>>` -> `() => Promise<... | undefined>`; `TimeSpan`
|
|
13
|
+
* -> millisecond `number`.
|
|
14
|
+
*/
|
|
15
|
+
class MeshSelfReportOptions {
|
|
16
|
+
serviceName;
|
|
17
|
+
specProvider;
|
|
18
|
+
healthProvider;
|
|
19
|
+
minimumIntervalMs;
|
|
20
|
+
/**
|
|
21
|
+
* @param serviceName This service's name (matches its registry entry's `name`).
|
|
22
|
+
* @param specProvider Produces this service's current spec document, verbatim, or `undefined` if unavailable.
|
|
23
|
+
* @param healthProvider Produces this service's current aggregated health response, or `undefined` if unavailable.
|
|
24
|
+
* @param minimumIntervalMs Minimum time between opportunistic publishes (ms). Defaults to 5 minutes.
|
|
25
|
+
*/
|
|
26
|
+
constructor(serviceName, specProvider, healthProvider, minimumIntervalMs = exports.DefaultMinimumIntervalMs) {
|
|
27
|
+
this.serviceName = serviceName;
|
|
28
|
+
this.specProvider = specProvider;
|
|
29
|
+
this.healthProvider = healthProvider;
|
|
30
|
+
this.minimumIntervalMs = minimumIntervalMs;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.MeshSelfReportOptions = MeshSelfReportOptions;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Port of Benzene.Mesh.Reporting.MeshSelfReportState. */
|
|
2
|
+
/**
|
|
3
|
+
* Tracks when `MeshSelfReportMiddleware` last published, so the `minimumIntervalMs` throttle survives across
|
|
4
|
+
* requests within one running process. Registered as a singleton (not static) so independent pipelines
|
|
5
|
+
* don't share type-local state.
|
|
6
|
+
*
|
|
7
|
+
* C#'s `Interlocked`-guarded `long` ticks collapse to a plain `number | undefined` (epoch ms): Node is
|
|
8
|
+
* single-threaded, so there's no torn read/write to guard against. On an ephemeral host this resets on cold
|
|
9
|
+
* start (an idle instance stops reporting rather than reporting stale data forever).
|
|
10
|
+
*/
|
|
11
|
+
export declare class MeshSelfReportState {
|
|
12
|
+
/** When the middleware last published (epoch ms), or `undefined` if it never has. */
|
|
13
|
+
lastPublishedAtUtc: number | undefined;
|
|
14
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/** Port of Benzene.Mesh.Reporting.MeshSelfReportState. */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.MeshSelfReportState = void 0;
|
|
5
|
+
/**
|
|
6
|
+
* Tracks when `MeshSelfReportMiddleware` last published, so the `minimumIntervalMs` throttle survives across
|
|
7
|
+
* requests within one running process. Registered as a singleton (not static) so independent pipelines
|
|
8
|
+
* don't share type-local state.
|
|
9
|
+
*
|
|
10
|
+
* C#'s `Interlocked`-guarded `long` ticks collapse to a plain `number | undefined` (epoch ms): Node is
|
|
11
|
+
* single-threaded, so there's no torn read/write to guard against. On an ephemeral host this resets on cold
|
|
12
|
+
* start (an idle instance stops reporting rather than reporting stale data forever).
|
|
13
|
+
*/
|
|
14
|
+
class MeshSelfReportState {
|
|
15
|
+
/** When the middleware last published (epoch ms), or `undefined` if it never has. */
|
|
16
|
+
lastPublishedAtUtc;
|
|
17
|
+
}
|
|
18
|
+
exports.MeshSelfReportState = MeshSelfReportState;
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Port of Benzene.Mesh.Reporting - push-based mesh self-reporting for services an aggregator can't poll:
|
|
3
|
+
* `HttpMeshReportPublisher` (POSTs a `MeshServiceReport` to an aggregator's ingestion endpoint) and
|
|
4
|
+
* `MeshSelfReportMiddleware` (opportunistically publishes the service's own spec/health after real traffic,
|
|
5
|
+
* throttled and best-effort), wired via `addMeshHttpReporting`/`addMeshSelfReport`/`useMeshSelfReport`.
|
|
6
|
+
*/
|
|
7
|
+
export * from './MeshReportingOptions';
|
|
8
|
+
export * from './HttpMeshReportPublisher';
|
|
9
|
+
export * from './MeshSelfReportOptions';
|
|
10
|
+
export * from './MeshSelfReportState';
|
|
11
|
+
export * from './MeshSelfReportMiddleware';
|
|
12
|
+
export * from './Extensions';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
/**
|
|
18
|
+
* Port of Benzene.Mesh.Reporting - push-based mesh self-reporting for services an aggregator can't poll:
|
|
19
|
+
* `HttpMeshReportPublisher` (POSTs a `MeshServiceReport` to an aggregator's ingestion endpoint) and
|
|
20
|
+
* `MeshSelfReportMiddleware` (opportunistically publishes the service's own spec/health after real traffic,
|
|
21
|
+
* throttled and best-effort), wired via `addMeshHttpReporting`/`addMeshSelfReport`/`useMeshSelfReport`.
|
|
22
|
+
*/
|
|
23
|
+
__exportStar(require("./MeshReportingOptions"), exports);
|
|
24
|
+
__exportStar(require("./HttpMeshReportPublisher"), exports);
|
|
25
|
+
__exportStar(require("./MeshSelfReportOptions"), exports);
|
|
26
|
+
__exportStar(require("./MeshSelfReportState"), exports);
|
|
27
|
+
__exportStar(require("./MeshSelfReportMiddleware"), exports);
|
|
28
|
+
__exportStar(require("./Extensions"), exports);
|
package/package.json
CHANGED
|
@@ -1,6 +1,18 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@benzenejs/mesh-reporting",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0-beta.2",
|
|
4
|
+
"description": "TypeScript port of Benzene.Mesh.Reporting",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "commonjs",
|
|
7
|
+
"main": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"dependencies": {
|
|
10
|
+
"@benzenejs/abstractions": "0.1.0-beta.2",
|
|
11
|
+
"@benzenejs/abstractions-middleware": "0.1.0-beta.2",
|
|
12
|
+
"@benzenejs/health-checks-core": "0.1.0-beta.2",
|
|
13
|
+
"@benzenejs/mesh-contracts": "0.1.0-beta.2"
|
|
14
|
+
},
|
|
15
|
+
"files": [
|
|
16
|
+
"dist"
|
|
17
|
+
]
|
|
18
|
+
}
|
package/README.md
DELETED