Skip to content
This repository was archived by the owner on Oct 31, 2024. It is now read-only.

Latest commit

 

History

History
61 lines (43 loc) · 6.38 KB

File metadata and controls

61 lines (43 loc) · 6.38 KB
description
Advanced configuration

Advanced

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):

Option NameEnvironment VariableTypeDefaultDescription
OptionEnvironment VariableTypeDefaultDescription
disableAspectoDISABLE_ASPECTObooleanfalse (aspecto enabled)Disable aspecto
envNODE_ENVstringprocess.env.NODE_ENVSet environment name manually
aspectoAuthASPECTO_AUTHUUIDSet Aspecto token from code instead of using aspecto.json
serviceNameOTEL_SERVICE_NAMEstring"name" in package.jsonSet serviceName manually instead of reading it from package.json. For example: a service that runs in multiple "modes"
serviceVersionOTEL_SERVICE_VERSIONstring"version" in package.jsonSet serviceVersion manually instead of reading it from package.json
samplingRatioASPECTO_SAMPLING_RATIOnumber1.0How many of the traces starting in this service should be sampled. Set to number in range [0.0, 1.0] where 0.0 is no sampling, and 1.0 is sample all. Specific rules set via aspecto app takes precedence
requireConfigForTracesASPECTO_REQUIRE_CONFIG_FOR_TRACESbooleanfalseWhen true, the SDK will not trace anything until remote sampling configuration arrives (few hundreds ms). Can be used to enforce sampling configuration is always applied, with the cost of losing traces generated during service startup.
logger-logger interfaceLogger to be used in this tracing library. Common use for debugging logger: console
collectPayloadsASPECTO_COLLECT_PAYLOADSbooleantrueShould Aspecto SDK collect payloads of operations
otlpCollectorEndpointOTEL_EXPORTER_OTLP_TRACES_ENDPOINTstringhttps://otelcol-fast.aspecto.io/v1/traceTarget URL to which the OTLP http exporter is going to send spans
exportBatchSizeASPECTO_EXPORT_BATCH_SIZEnumber100How many spans to batch in a single export to the collector
exportBatchTimeoutMsASPECTO_EXPORT_BATCH_TIMEOUT_MSnumber1000 (1s)Maximum time in ms for batching spans before sending to collector
writeSystemLogs-booleanfalseIf true, emit all log messages from Opentelemetry SDK to supplied logger if present, or to console if missing
customZipkinEndpoint-URLSend all traces to additional Zipkin server for debug
sqsExtractContextPropagationFromPayloadASPECTO_SQS_EXTRACT_CONTEXT_PROPAGATION_FROM_PAYLOADbooleantrueFor aws-sdk instrumentation. Should be true when the service receiveMessages from SQS which is subscribed to SNS and subscription configured with "Raw message delivery": Disabled. Setting to false is a bit more performant as it turns off JSON parse on message payload
extractB3ContextASPECTO_EXTRACT_B3_CONTEXTbooleanfalseSet to true when the service receives requests from another instrumented component that propagate context via B3 protocol multi or single header. For example: Envoy Proxy, Ambassador and Istio
injectB3ContextSingleHeaderASPECTO_INJECT_B3_CONTEXT_SINGLE_HEADERbooleanfalseSet to true when the service send traffic to another instrumented component that propagate context via B3 single header protocol
injectB3ContextMultiHeaderASPECTO_INJECT_B3_CONTEXT_MULTI_HEADERbooleanfalseSet to true when the service send traffic to another instrumented component that propagate context via B3 multi header protocol. For example: Envoy Proxy, Istio

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.