1.31.2 • Published 6 days ago

@contrast/core v1.31.2

Weekly downloads
-
License
SEE LICENSE IN LI...
Repository
-
Last release
6 days ago

@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/logger service here.

  • Monkey-patching

    core.patcher.patch(res, 'end', {
      name: 'http.ServerResponse.end',
      patchType: 'http-things',
      pre(data) {
        // ...
      }
    });

    See more about the @contrast/patcher service here.

  • Code rewriting

    core.rewriter.addTransforms({
      CallExpression(path, state) {
        // ...
      };
    });
    core.rewriter.rewrite('function() { ...');

    See more about the @contrast/rewriter service here.

  • Dependency hooks

    core.depHooks.resolve({ name: 'http' }, http => {
      // implemention details
    });

    See more about the @contrast/dep-hooks service 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/models service here.

  • Report messages

    // configuration will tell which reporters become active
    core.reporters.install();
    core.messages.emit('ProtectInputTracingEvent', { ... });

    See more about the @contrast/reporter service 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.

1.31.2

6 days ago

1.31.1

18 days ago

1.31.0

27 days ago

1.30.0

2 months ago

1.29.1

3 months ago

1.29.0

3 months ago

1.28.0

3 months ago

1.27.2

3 months ago

1.27.1

4 months ago

1.27.0

5 months ago

1.19.0

9 months ago

1.18.0

10 months ago

1.17.0

10 months ago

1.21.0

9 months ago

1.22.0

8 months ago

1.20.0

9 months ago

1.25.0

7 months ago

1.26.0

7 months ago

1.23.0

7 months ago

1.24.0

7 months ago

1.23.1

7 months ago

1.26.1

6 months ago

1.15.0

12 months ago

1.14.0

1 year ago

1.13.1

1 year ago

1.13.0

1 year ago

1.12.0

1 year ago

1.16.0

11 months ago

1.11.1

1 year ago

1.11.0

1 year ago

1.10.2

1 year ago

1.9.0

1 year ago

1.8.1

1 year ago

1.8.0

1 year ago

1.10.1

1 year ago

1.10.0

1 year ago

1.7.1

1 year ago

1.7.0

1 year ago

1.6.1

2 years ago

1.5.2

2 years ago

1.6.0

2 years ago

1.5.1

2 years ago

1.5.0

2 years ago

1.4.0

2 years ago

1.3.0

2 years ago

1.2.0

2 years ago

1.1.2

2 years ago

1.1.1

2 years ago

1.1.0

2 years ago

1.0.0

2 years ago