lightstep-tracer-javascript
lightstep-tracer-javascript copied to clipboard
TS type definitions
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 , 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 a nice way to get correct type is to have the project in typescript. 😄
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 Any chance you can add this to DefinitelyTyped or make a PR to this package to add a index,d.ts file?
@mlavina you're welcome to take my code above and do that :)
Since the above MR is merged, can this issue be closed?