@codebayu/usesignoz
v1.2.3
Published
The reusable plugin to implement signoz on Nuxt project
Downloads
4
Maintainers
Readme
@codebayu/usesignoz
A utility package to simplify the integration of Signoz (OpenTelemetry-based observability) in Nuxt.js projects.
Installation
# npm
npm install @codebayu/usesignoz
# yarn
yarn add @codebayu/usesignoz
Usage
initTracer
import { initTracer } from '@codebayu/usesignoz';
const tracer = initTracer({
serviceName: 'your-service-name',
exporterUrl: 'http://your-exporter-url',
attributes: {
path: '/example',
uuid: 'user-123',
},
});
createSpan
import { createSpan } from '@codebayu/usesignoz';
const spanName = 'your-span-name';
createSpan({
tracer,
name: spanName,
func: () => {
// Your code to be executed within the span
},
attributes: {
key1: 'value1',
key2: 'value2',
},
events: {
name: 'event-name',
keyValue: { key: 'value' },
},
});
Example
import { initTracer, createSpan } from '@codebayu/usesignoz';
const tracer = initTracer({
serviceName: 'example-nuxt-project',
exporterUrl: 'http://127.0.0.1:4318/v1/traces',
attributes: {
path: '/example',
uuid: 'user-123',
},
});
// Creating a span for a specific operation
createSpan({
tracer,
name: 'example-operation',
func: () => {
// Your code for the operation
console.log('Executing example operation...');
},
attributes: {
key1: 'value1',
key2: 'value2',
},
events: {
name: 'operation-event',
keyValue: { status: 'completed' },
},
});
License
This project is licensed under the MIT License - see the LICENSE file for details.