Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add typings for ext submodules #545

Merged
merged 3 commits into from
May 1, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion docs/test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,26 @@
import ddTrace, { tracer, Tracer, TracerOptions, Span, SpanContext, SpanOptions, Scope } from '..';
import { HTTP_HEADERS } from '../ext/formats';
import { formats, kinds, priority, tags, types } from '../ext';
import { BINARY, HTTP_HEADERS, LOG, TEXT_MAP } from '../ext/formats';
import { SERVER, CLIENT, PRODUCER, CONSUMER } from '../ext/kinds'
import { USER_REJECT, AUTO_REJECT, AUTO_KEEP, USER_KEEP } from '../ext/priority'
import {
ANALYTICS,
ERROR,
HTTP_METHOD,
HTTP_REQUEST_HEADERS,
HTTP_RESPONSE_HEADERS,
HTTP_ROUTE,
HTTP_STATUS_CODE,
HTTP_URL,
MANUAL_DROP,
MANUAL_KEEP,
RESOURCE_NAME,
SAMPLING_PRIORITY,
SERVICE_NAME,
SPAN_KIND,
SPAN_TYPE,
} from '../ext/tags'
import { HTTP, WEB } from '../ext/types'
import * as opentracing from 'opentracing';

opentracing.initGlobalTracer(tracer);
Expand Down
10 changes: 10 additions & 0 deletions ext/formats.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import * as opentracing from 'opentracing'

declare const formats: {
TEXT_MAP: typeof opentracing.FORMAT_TEXT_MAP
HTTP_HEADERS: typeof opentracing.FORMAT_HTTP_HEADERS
BINARY: typeof opentracing.FORMAT_BINARY
LOG: 'log'
}

export = formats
7 changes: 7 additions & 0 deletions ext/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import * as formats from './formats'
import * as kinds from './kinds'
import * as priority from './priority'
rochdev marked this conversation as resolved.
Show resolved Hide resolved
import * as tags from './tags'
import * as types from './types'

export { formats, kinds, priority, tags, types }
8 changes: 6 additions & 2 deletions ext/index.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
'use strict'

const formats = require('./formats')
const kinds = require('./kinds')
const priority = require('./priority')
const tags = require('./tags')
const formats = require('./formats')
const types = require('./types')

module.exports = {
formats,
kinds,
priority,
tags,
formats
types
}
8 changes: 8 additions & 0 deletions ext/kinds.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare const kinds: {
SERVER: 'server'
CLIENT: 'client'
PRODUCER: 'producer'
CONSUMER: 'consumer'
}

export = kinds
8 changes: 8 additions & 0 deletions ext/priority.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
declare const priority: {
USER_REJECT: -1
AUTO_REJECT: 0
AUTO_KEEP: 1
USER_KEEP: 2
}
rochdev marked this conversation as resolved.
Show resolved Hide resolved

export = priority
19 changes: 19 additions & 0 deletions ext/tags.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
declare const tags: {
SERVICE_NAME: 'service.name'
RESOURCE_NAME: 'resource.name'
SPAN_TYPE: 'span.type'
SPAN_KIND: 'span.kind'
SAMPLING_PRIORITY: 'sampling.priority'
ANALYTICS: '_dd1.sr.eausr'
ERROR: 'error'
MANUAL_KEEP: 'manual.keep'
MANUAL_DROP: 'manual.drop'
HTTP_URL: 'http.url'
HTTP_METHOD: 'http.method'
HTTP_STATUS_CODE: 'http.status_code'
HTTP_ROUTE: 'http.route'
HTTP_REQUEST_HEADERS: 'http.request.headers'
HTTP_RESPONSE_HEADERS: 'http.response.headers'
}

export = tags
6 changes: 6 additions & 0 deletions ext/types.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
declare const types: {
HTTP: 'http'
WEB: 'web'
}

export = types