@contrast/core v1.52.0
@contrast/core
Discovers Contrast configuration data (yaml, env vars, etc) and preconfigures a common set of APIs to be used for agent and tooling development.
Basic Usage
The module exports a factory function.
const core = require('@contrast/core')();What You Get
Logging
core.logger.info('...');See more about the
@contrast/loggerservice here.Monkey-patching
core.patcher.patch(res, 'end', { name: 'http.ServerResponse.end', patchType: 'http-things', pre(data) { // ... } });See more about the
@contrast/patcherservice here.
Code rewriting
core.rewriter.addTransforms({ CallExpression(path, state) { // ... }; }); core.rewriter.rewrite('function() { ...');See more about the
@contrast/rewriterservice here.
Dependency hooks
core.depHooks.resolve({ name: 'http' }, http => { // implemention details });See more about the
@contrast/dep-hooksservice here.
Models and factories
The construction of model data can rely on configuration and therefore can be stateful. So, we provide the models and their factories as services that can be used by consumers as if static.
// stackframe filtration is configurable, thus stateful const snap = core.models.StacktraceFactory.createSnapshot(); const frames = snap();See more about the
@contrast/modelsservice here.Report messages
// configuration will tell which reporters become active core.reporters.install(); core.messages.emit('ProtectInputTracingEvent', { ... });See more about the
@contrast/reporterservice here.Other stuff
There are some utility-type functions that rely on configuration state.
// This uses core.config.stack_trace_filters (new to v5) core.isAgentPath('/foo');
Related
@contrast/agentify: Integrate core services and instrumentation into an application. See more here.
12 months ago
10 months ago
9 months ago
8 months ago
7 months ago
1 year ago
11 months ago
10 months ago
10 months ago
8 months ago
10 months ago
8 months ago
7 months ago
6 months ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
2 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago
3 years ago