Advanced

Advanced configuration

Configuration Methods

You can pass a configuration options object when initializing Aspecto in code, like this for example:

require('@aspecto/opentelemetry')({
    serviceName: 'my-service',
    env: 'production',
    samplingRatio: 0.1
});

Or add configuration file named aspecto.json near your package.json with the same options as above:

{
    serviceName: 'my-service',
    env: 'production',
    samplingRatio: 0.1
}

Or use various environment variables, for example:

export OTEL_SERVICE_NAME=my-service

Values are evaluated in the following priority:

  1. options object

  2. environment variables

  3. config file

  4. default values

Configuration Options

Available install configurations (all are optional):

Advanced Settings

Exporting Format

Data collected by the SDK is sent to Aspecto's collector in protobuf format by default. An alternative is to send the data in JSON format, which uses less CPU for encoding the message but is more verbose - causing more data to be sent over the network. To export data over JSON instead of protobuf, set the environment variable ASPECTO_TRACE_EXPORT_JSON to any value.

Disabling Aspecto

Set the environment variable DISABLE_ASPECTO to any value, to disable Aspecto. Affect lambda and GCF wrappers as well. Useful when running unit tests, or as a simple kill switch.

Last updated