1.2.3 • Published 25 days ago

@codebayu/usesignoz v1.2.3

Weekly downloads
-
License
MIT
Repository
-
Last release
25 days ago

@codebayu/usesignoz

npm

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.

1.2.3

25 days ago

1.2.0

3 months ago

1.1.0

3 months ago

1.2.2

3 months ago

1.2.1

3 months ago

1.0.11

3 months ago

1.0.10

3 months ago

1.0.14

3 months ago

1.0.13

3 months ago

1.0.12

3 months ago

1.0.9

5 months ago

1.0.8

5 months ago

1.0.7

5 months ago

1.0.6

5 months ago

1.0.5

5 months ago

1.0.4

6 months ago

1.0.3

6 months ago

1.0.2

6 months ago

1.0.1

6 months ago

1.0.0

6 months ago