Security News
Weekly Downloads Now Available in npm Package Search Results
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
aedes-otel-instrumentation
Advanced tools
OpenTelemetry instrumentation library for Aedes MQTT broker
⚠️ Experimental ⚠️
This library provides automatic tracing instrumentation for Aedes and mqtt-packet. It follows OTel guidelines.
Compatible with OpenTelemetry JS API and SDK 1.0+
.
npm install --save aedes-otel-instrumentation
Aedes:
MQTT-packet
OpenTelemetry Aedes Instrumentation allows the user to automatically collect trace data from Aedes. It can also collect distributed traces from MQTT clients that use mqtt-packet library and the MqttPacketInstrumentation. Other MQTT client libraries can be supported by adding the OpenTelemetry context to the MQTT packet, as described here.
To load the instrumentation, specify it in the instrumentations
options of the OTel NodeSDK.
import { getNodeAutoInstrumentations } from '@opentelemetry/auto-instrumentations-node'
import { Resource } from '@opentelemetry/resources'
import {
PeriodicExportingMetricReader,
ConsoleMetricExporter,
} from '@opentelemetry/sdk-metrics'
import { NodeSDK } from '@opentelemetry/sdk-node'
import {
BatchSpanProcessor,
ConsoleSpanExporter,
} from '@opentelemetry/sdk-trace-base'
import { SemanticResourceAttributes } from '@opentelemetry/semantic-conventions'
import { getNodeMqttAutoInstrumentations } from 'aedes-otel-instrumentation'
const traceExporter = new ConsoleSpanExporter()
const metricExporter = new ConsoleMetricExporter()
const metricReader = new PeriodicExportingMetricReader({
exporter: metricExporter,
})
const sdk = new NodeSDK({
resource: new Resource({
[SemanticResourceAttributes.SERVICE_NAME]: 'test service',
[SemanticResourceAttributes.SERVICE_VERSION]:
process.env.npm_package_version,
[SemanticResourceAttributes.DEPLOYMENT_ENVIRONMENT]: process.env.NODE_ENV,
}),
traceExporter,
metricReader,
instrumentations: [
getNodeAutoInstrumentations({
'@opentelemetry/instrumentation-fs': {
enabled: false,
},
}),
getNodeMqttAutoInstrumentations({
'@opentelemetry/instrumentation-mqtt-packet': {
enabled: true,
},
'@opentelemetry/instrumentation-aedes': {
enabled: true,
publishHook: (span, info) => {
console.log('publishHook', span)
},
consumeHook: (span, info) => {
console.log('consumeHook', span)
},
consumeEndHook: (span, info) => {
console.log('consumeEndHook', span)
},
},
}),
],
spanProcessor: new BatchSpanProcessor(traceExporter),
})
sdk.start()
process.on('SIGTERM', () => {
sdk
.shutdown()
.catch((error) => console.error('Error terminating tracing', error))
})
Check the example folder for more details.
Name | Aedes method | Description |
---|---|---|
mqtt.connect | handleConnect | A client is connected |
{topic} publish | handlePublish | A client published a message |
{topic} receive | handleSubscribe & `Aedes.subscribe`` | A client received a message |
MIT - See LICENSE for more information.
0.2.0 (2023-10-09)
aedes.wrapDeliveryFunc
to correctly modify delivery function (44cbaef)FAQs
OpenTelemetry instrumentation library for Aedes MQTT broker
The npm package aedes-otel-instrumentation receives a total of 9 weekly downloads. As such, aedes-otel-instrumentation popularity was classified as not popular.
We found that aedes-otel-instrumentation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.
Security News
A Stanford study reveals 9.5% of engineers contribute almost nothing, costing tech $90B annually, with remote work fueling the rise of "ghost engineers."
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.