lightstep-tracer-javascript icon indicating copy to clipboard operation
lightstep-tracer-javascript copied to clipboard

TS type definitions

Open DeTeam opened this issue 6 years ago • 6 comments

It'd be nice to have typescript definitions for lightstep tracer, since it extends what's in opentracing spec.

Would this repo be a good place to host such typedefs?

DeTeam avatar Jul 24 '18 07:07 DeTeam

@DeTeam , admittedly I'm not a TypeScript expert but if it's conventional to host typedefs along with the JS code, I'd be glad to accept the addition!

bcronin avatar Jul 27 '18 01:07 bcronin

@bcronin a nice way to get correct type is to have the project in typescript. 😄

ruiaraujo avatar Sep 02 '18 08:09 ruiaraujo

Here are some definitions I wrote for a project (some options are missing):

declare module 'lightstep-tracer' {
    import * as opentracing from 'opentracing'

    export interface TracerOptions {
        /** the project access token */
        access_token: string

        /** the string identifier for the application, service, or process */
        component_name: string

        /**
         * controls the level of logging to the console
         *
         * - 0 - the client library will never log to the console
         * - 1 - error reporting will be throttled to the first error per minute
         * - 2 - all errors are logged to the console
         * - 3 - all errors, warnings, and info statements are logged to the console
         * - 4 - all log statements, including debugging details
         *
         * @default 1
         */
        verbosity?: number

        /** custom collector hostname */
        collector_host?: string

        /** custom collector port */

        collector_port?: number
        /** custom collector base path (if served behind a reverse proxy) */
        collector_path?: string
    }

    export class Tracer extends opentracing.Tracer {
        constructor(options: TracerOptions)

        public startSpan(name: string, options?: opentracing.SpanOptions): Span
    }

    class Span extends opentracing.Span {
        public generateTraceURL(): string
    }
}

felixfbecker avatar Nov 08 '18 00:11 felixfbecker

@felixfbecker Any chance you can add this to DefinitelyTyped or make a PR to this package to add a index,d.ts file?

mlavina avatar Jul 31 '19 11:07 mlavina

@mlavina you're welcome to take my code above and do that :)

felixfbecker avatar Jul 31 '19 11:07 felixfbecker

Since the above MR is merged, can this issue be closed?

keeganwitt avatar May 04 '21 03:05 keeganwitt