# finciero-zipkin-js

> Finciero package to encapsulate zipkin trace logic

Latest version **1.1.2** (published 2016-09-21) · ISC license · 0 weekly downloads

## Install

```sh
npm install finciero-zipkin-js
pnpm add finciero-zipkin-js
yarn add finciero-zipkin-js
bun add finciero-zipkin-js
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2016-09-21 |
| First published | 2016-09-14 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 4 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Rodrigo Fuenzalida |
| Maintainers | rodrwan |
| Keywords | zipkin, trace, kafka |

## Links

- npm: https://www.npmjs.com/package/finciero-zipkin-js
- Repository: https://github.com/Finciero/finciero-zipkin-js
- Homepage: https://github.com/Finciero/finciero-zipkin-js#readme
- Issues: https://github.com/Finciero/finciero-zipkin-js/issues
- npm.io page: https://npm.io/package/finciero-zipkin-js

## Dependencies (4)

- [lodash](https://npm.io/package/lodash.md) ^4.15.0
- [zipkin](https://npm.io/package/zipkin.md) ^0.2.6
- [finciero-logger](https://npm.io/package/finciero-logger.md) ^1.0.0
- [zipkin-transport-kafka](https://npm.io/package/zipkin-transport-kafka.md) ^0.2.6

## Alternatives

- [lodash.startswith](https://npm.io/package/lodash.startswith.md) — 769.7K weekly downloads
- [@tarojs/service](https://npm.io/package/@tarojs/service.md) — 33.9K weekly downloads
- [io.extendreality.tilia.indicators.spatialtargets.unity](https://npm.io/package/io.extendreality.tilia.indicators.spatialtargets.unity.md) — 131 weekly downloads
- [@rtarojs/taro](https://npm.io/package/@rtarojs/taro.md) — 90 weekly downloads
- [node-branch-io](https://npm.io/package/node-branch-io.md) — 50 weekly downloads

## Recent versions

- 1.1.2 (latest) — 2016-09-21
- 1.1.1 — 2016-09-14
- 1.1.0 — 2016-09-14
- 1.0.1 — 2016-09-14
- 1.0.0 — 2016-09-14

## README

# Finciero JS Zipkin

[![NPM](https://nodei.co/npm/finciero-zipkin-js.png)](https://nodei.co/npm/finciero-zipkin-js/)

[![npm version](https://badge.fury.io/js/finciero-zipkin-js.svg)](https://badge.fury.io/js/finciero-zipkin-js)

finciero-zipkin-js is an abstraction of [zipkin-js](https://github.com/openzipkin/zipkin-js)
This library let us start a new `zipkin tracer` or continue a `child trace`.

# Config zipkin and kafka.

To use this library you need setup `KAFKA_SERVICE_URL` in your environment variables.
Also, you can use [this](https://github.com/openzipkin/docker-zipkin) to run kafka and zipkin with docker.

# Usage

The basic usage is as follow:

```js
const { TracerJS } = require('finciero-zipkin-js')

const tracer = new TracerJS()
tracer.config({
  name: 'service-name',
  kind: 'service-kind',
  logger: someLogger(),
})
```

then you can start a new trace with:

```js
tracer.start()
```

Or you can pass and object with an old tracer:

```js
const oldTracerData = {
  traceId: 'some-trace-id',
  parentId: 'some-parent-id',
  spanId: 'some-span-id',
  sampled: true,
}
tracer.start(oldTracerData)
```

And this will continue the trace given in the method parameters.

To finish a trace record, just use:

```js
tracer.finish()
```

This will stop the current trace record. If an error happen in your program, you can pass as argument the error and the `finish` method will trace the error, this push the error data to kafka and zipkin.

```js
const err = new Error('awesome error')
tracer.finish(err)
```

---
_Source: https://npm.io/package/finciero-zipkin-js · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
