5.14.1 • Published 9 months ago

lite-ts-jaeger-client v5.14.1

Weekly downloads
-
License
GPL-3.0
Repository
-
Last release
9 months ago

Version

安装

npm install lite-ts-jaeger-client

使用

import { ChildTracer, RootTracer } from 'lite-ts-jaeger-client';

// 非入口服务使用
const tracer = new ChildTracer({
    serviceName: 'my-service',
    reporter: {
        collectorEndpoint: 'http://127.0.0.1:14268/api/traces'
    },
    sampler: {
        type: 'const',
        param: 1
    }
}, {
    tags: {
        version: '1.0.0'
    }
});

// 一般在入口服务使用,例如网关
const rootTracer = new RootTracer({
    serviceName: 'my-service',
    reporter: {
        collectorEndpoint: 'http://127.0.0.1:14268/api/traces'
    },
    sampler: {
        type: 'const',
        param: 1
    }
}, {
    tags: {
        version: '1.0.0'
    }
}, async () => {
    return true;
});

const req: Request;
const parentSpan = tracer.extract(opentracing.FORMAT_HTTP_HEADERS, headers); // 获取父Span

const span = tracer.startSpan('/app/mh/test', {
    childOf: parentSpan
});

span.log({
    body: req.body,
    headers: req.headers
});

span.addTags({
    'error': true,
    'otherTag': 'tagValue'
});
span.setTag('authID', 'userID1');

span.finish();
4.14.1

11 months ago

5.14.1

9 months ago

4.13.1

11 months ago

3.11.0

1 year ago

3.10.0

1 year ago

3.12.1

1 year ago

3.11.1

1 year ago

1.9.0

1 year ago

1.8.0

1 year ago

1.7.0

1 year ago

1.6.0

1 year ago

1.5.0

1 year ago

1.4.0

1 year ago

3.13.1

1 year ago

3.9.0

1 year ago

1.3.0

1 year ago

1.2.0

1 year ago

1.1.0

1 year ago

1.0.0

1 year ago