@intutic/mcp-governance-proxy 3.1.4 → 3.1.5
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.
|
@@ -16,46 +16,58 @@
|
|
|
16
16
|
* Must be imported at the very top of daemon/index.ts, before other
|
|
17
17
|
* modules, to allow monkey-patching.
|
|
18
18
|
*/
|
|
19
|
-
import {
|
|
19
|
+
import { metrics } from '@opentelemetry/api';
|
|
20
20
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-http';
|
|
21
21
|
import { OTLPMetricExporter } from '@opentelemetry/exporter-metrics-otlp-http';
|
|
22
|
-
import {
|
|
23
|
-
import {
|
|
22
|
+
import { registerInstrumentations } from '@opentelemetry/instrumentation';
|
|
23
|
+
import { HttpInstrumentation } from '@opentelemetry/instrumentation-http';
|
|
24
|
+
import { IORedisInstrumentation } from '@opentelemetry/instrumentation-ioredis';
|
|
25
|
+
import { RuntimeNodeInstrumentation } from '@opentelemetry/instrumentation-runtime-node';
|
|
26
|
+
import { UndiciInstrumentation } from '@opentelemetry/instrumentation-undici';
|
|
24
27
|
import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
28
|
+
import { MeterProvider, PeriodicExportingMetricReader } from '@opentelemetry/sdk-metrics';
|
|
29
|
+
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
30
|
+
import { NodeTracerProvider } from '@opentelemetry/sdk-trace-node';
|
|
25
31
|
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
26
32
|
import { createLogger } from '@intutic/logger';
|
|
27
33
|
const log = createLogger('instrumentation');
|
|
28
|
-
const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT ?? 'http://localhost:4318/v1/traces';
|
|
29
|
-
const serviceName = process.env.OTEL_SERVICE_NAME ?? 'mcp-daemon';
|
|
30
34
|
// The env var may name either the collector base or the full traces path;
|
|
31
35
|
// derive the base once so traces and metrics land on their own signal paths.
|
|
32
|
-
const
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}),
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
36
|
+
const endpoint = process.env.OTEL_EXPORTER_OTLP_ENDPOINT;
|
|
37
|
+
if (endpoint) {
|
|
38
|
+
const serviceName = process.env.OTEL_SERVICE_NAME ?? 'mcp-daemon';
|
|
39
|
+
const base = endpoint.replace(/\/v1\/traces$/, '');
|
|
40
|
+
const resource = resourceFromAttributes({ [ATTR_SERVICE_NAME]: serviceName });
|
|
41
|
+
// Not `NodeSDK` or `auto-instrumentations-node`: both depend on every exporter
|
|
42
|
+
// including gRPC, which puts protobufjs and its install script on every
|
|
43
|
+
// `npm install -g @intutic/cli`, for a feature that is off by default.
|
|
44
|
+
// shortcut: sdk-trace-base and sdk-trace-node are deprecated for sdk-trace 3,
|
|
45
|
+
// which needs Node >= 22.15; move to it when the CLI's engines drop Node 20.
|
|
46
|
+
const tracerProvider = new NodeTracerProvider({
|
|
47
|
+
resource,
|
|
48
|
+
spanProcessors: [new BatchSpanProcessor(new OTLPTraceExporter({ url: `${base}/v1/traces` }))],
|
|
49
|
+
});
|
|
50
|
+
tracerProvider.register();
|
|
51
|
+
const meterProvider = new MeterProvider({
|
|
52
|
+
resource,
|
|
53
|
+
readers: [new PeriodicExportingMetricReader({ exporter: new OTLPMetricExporter({ url: `${base}/v1/metrics` }) })],
|
|
54
|
+
});
|
|
55
|
+
metrics.setGlobalMeterProvider(meterProvider);
|
|
56
|
+
registerInstrumentations({
|
|
57
|
+
tracerProvider,
|
|
58
|
+
meterProvider,
|
|
59
|
+
instrumentations: [
|
|
60
|
+
new HttpInstrumentation(),
|
|
61
|
+
new UndiciInstrumentation(),
|
|
62
|
+
new IORedisInstrumentation(),
|
|
63
|
+
new RuntimeNodeInstrumentation(),
|
|
64
|
+
],
|
|
65
|
+
});
|
|
54
66
|
log.info({ action: 'otel_init', serviceName, endpoint }, 'Tracing SDK initialized');
|
|
67
|
+
process.on('SIGTERM', () => {
|
|
68
|
+
Promise.all([tracerProvider.shutdown(), meterProvider.shutdown()])
|
|
69
|
+
.then(() => log.info({ action: 'otel_shutdown' }, 'Tracing SDK terminated gracefully'))
|
|
70
|
+
.catch((err) => log.error({ err, action: 'otel_shutdown_failed' }, 'Error terminating Tracing SDK'));
|
|
71
|
+
});
|
|
55
72
|
}
|
|
56
|
-
process.on('SIGTERM', () => {
|
|
57
|
-
sdk.shutdown()
|
|
58
|
-
.then(() => log.info({ action: 'otel_shutdown' }, 'Tracing SDK terminated gracefully'))
|
|
59
|
-
.catch((err) => log.error({ err, action: 'otel_shutdown_failed' }, 'Error terminating Tracing SDK'));
|
|
60
|
-
});
|
|
61
73
|
//# sourceMappingURL=instrumentation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/daemon/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"instrumentation.js","sourceRoot":"","sources":["../../src/daemon/instrumentation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,oBAAoB,CAAA;AAC5C,OAAO,EAAE,iBAAiB,EAAE,MAAM,yCAAyC,CAAA;AAC3E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAA;AAC9E,OAAO,EAAE,wBAAwB,EAAE,MAAM,gCAAgC,CAAA;AACzE,OAAO,EAAE,mBAAmB,EAAE,MAAM,qCAAqC,CAAA;AACzE,OAAO,EAAE,sBAAsB,EAAE,MAA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aAAa,CAAC;QACtC,QAAQ;QACR,OAAO,EAAE,CAAC,IAAI,6BAA6B,CAAC,EAAE,QAAQ,EAAE,IAAI,kBAAkB,CAAC,EAAE,GAAG,EAAE,GAAG,IAAI,aAAa,EAAE,CAAC,EAAE,CAAC,CAAC;KAClH,CAAC,CAAA;IACF,OAAO,CAAC,sBAAsB,CAAC,aAAa,CAAC,CAAA;IAC7C,wBAAwB,CAAC;QACvB,cAAc;QACd,aAAa;QACb,gBAAgB,EAAE;YAChB,IAAI,mBAAmB,EAAE;YACzB,IAAI,qBAAqB,EAAE;YAC3B,IAAI,sBAAsB,EAAE;YAC5B,IAAI,0BAA0B,EAAE;SACjC;KACF,CAAC,CAAA;IACF,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,EAAE,QAAQ,EAAE,EAAE,yBAAyB,CAAC,CAAA;IAEnF,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,GAAG,EAAE;QACzB,OAAO,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,QAAQ,EAAE,EAAE,aAAa,CAAC,QAAQ,EAAE,CAAC,CAAC;aAC/D,IAAI,CAAC,GAAG,EAAE,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,MAAM,EAAE,eAAe,EAAE,EAAE,mCAAmC,CAAC,CAAC;aACtF,KAAK,CAAC,CAAC,GAAY,EAAE,EAAE,CAAC,GAAG,CAAC,KAAK,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,sBAAsB,EAAE,EAAE,+BAA+B,CAAC,CAAC,CAAA;IACjH,CAAC,CAAC,CAAA;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@intutic/mcp-governance-proxy",
|
|
3
|
-
"version": "3.1.
|
|
3
|
+
"version": "3.1.5",
|
|
4
4
|
"description": "Intutic MCP Governance Proxy — transparent stdio proxy that intercepts all tools/call JSON-RPC messages and applies workspace SOP policy before forwarding to real MCP servers",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,18 +24,23 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@modelcontextprotocol/sdk": "^1.31.0",
|
|
26
26
|
"@opentelemetry/api": "^1.9.1",
|
|
27
|
-
"@opentelemetry/auto-instrumentations-node": "^0.79.0",
|
|
28
27
|
"@opentelemetry/exporter-metrics-otlp-http": "^0.221.0",
|
|
29
28
|
"@opentelemetry/exporter-trace-otlp-http": "^0.221.0",
|
|
29
|
+
"@opentelemetry/instrumentation": "^0.221.0",
|
|
30
|
+
"@opentelemetry/instrumentation-http": "^0.221.0",
|
|
31
|
+
"@opentelemetry/instrumentation-ioredis": "^0.69.0",
|
|
32
|
+
"@opentelemetry/instrumentation-runtime-node": "^0.34.0",
|
|
33
|
+
"@opentelemetry/instrumentation-undici": "^0.31.0",
|
|
30
34
|
"@opentelemetry/resources": "^2.10.0",
|
|
31
35
|
"@opentelemetry/sdk-metrics": "^2.10.0",
|
|
32
|
-
"@opentelemetry/sdk-
|
|
36
|
+
"@opentelemetry/sdk-trace-base": "^2.10.0",
|
|
37
|
+
"@opentelemetry/sdk-trace-node": "^2.10.0",
|
|
33
38
|
"@opentelemetry/semantic-conventions": "^1.43.0",
|
|
34
39
|
"ioredis": "^5",
|
|
35
40
|
"zod": "^4.6.6",
|
|
36
|
-
"@intutic/
|
|
37
|
-
"@intutic/shared-types": "3.1.
|
|
38
|
-
"@intutic/
|
|
41
|
+
"@intutic/id": "3.1.5",
|
|
42
|
+
"@intutic/shared-types": "3.1.5",
|
|
43
|
+
"@intutic/logger": "3.1.5"
|
|
39
44
|
},
|
|
40
45
|
"devDependencies": {
|
|
41
46
|
"@types/node": "^22",
|