Index

src/tracing-policy.ts

alwaysTrace
alwaysTrace()
Returns : BuiltinTracePolicy
neverTrace
neverTrace()
Returns : BuiltinTracePolicy

src/plugins/plugin-connect.ts

createMiddleware
createMiddleware(api)
Parameters :
Name Optional
api No
Returns : connect_3.NextHandleFunction

src/plugins/plugin-koa.ts

createMiddleware
createMiddleware(api)
Parameters :
Name Optional
api No
Returns : koa_1.Middleware
createMiddleware2x
createMiddleware2x(api)
Parameters :
Name Optional
api No
Returns : koa_2.Middleware
patchUse
patchUse(koa: KoaModule, api, createMiddlewareFunction: CreateMiddlewareFn)
Parameters :
Name Type Optional
koa KoaModule No
api No
createMiddlewareFunction CreateMiddlewareFn No
startSpanForRequest
startSpanForRequest(api, ctx: KoaContext, getNext: GetNextFn)
Parameters :
Name Type Optional
api No
ctx KoaContext No
getNext GetNextFn No
Returns : T

src/span-data.ts

createPhantomSpanData
createPhantomSpanData(spanType: T)
Parameters :
Name Type Optional
spanType T No
randomSpanId
randomSpanId()

src/util.ts

createStackTrace
createStackTrace(numFrames: number, skipFrames: number, constructorOpt?: Function)

Creates a StackFrame object containing a structured stack trace.

Parameters :
Name Type Optional Description
numFrames number No

The number of frames to retain.

skipFrames number No

The number of top-most frames to remove.

constructorOpt Function Yes

A function passed to Error.captureStackTrace, which causes it to ignore the frames above the top-most call to this function.

Returns : StackFrame[]
deserializeTraceContext
deserializeTraceContext(buffer: Buffer)

Deseralize the given trace context from binary encoding. If the input is a Buffer of incorrect size or unexpected fields, then this function will return null.

Parameters :
Name Type Optional Description
buffer Buffer No

The trace context to deserialize.

Returns : TraceContext | null
generateTraceContext
generateTraceContext(traceContext: TraceContext)

Generates a trace context header value that can be used to follow the associated request through other Google services.

Parameters :
Name Type Optional Description
traceContext TraceContext No

An object with information sufficient for creating a serialized trace context.

Returns : string
lastOf
lastOf(defaultValue: T, ...otherValues: Array)

Returns the last parameter that is not null, undefined, or NaN.

Parameters :
Name Type Optional Description
defaultValue T No

The first parameter. This must not be null/undefined/NaN.

otherValues Array No

Other parameters, which may be null/undefined/NaN.

Returns : T
packageNameFromPath
packageNameFromPath(importPath: string)

Retrieves a package name from the full import path. For example: './node_modules/bar/index/foo.js' => 'bar'

Parameters :
Name Type Optional
importPath string No
parseContextFromHeader
parseContextFromHeader(str: string)

Parse a cookie-style header string to extract traceId, spandId and options ex: '123456/667;o=3' -> {traceId: '123456', spanId: '667', options: '3'} note that we ignore trailing garbage if there is more than one '=' Returns null if traceId or spanId could not be found.

Parameters :
Name Type Optional Description
str string No

string representation of the trace headers

Returns : TraceContext | null

object with keys. null if there is a problem.

serializeTraceContext
serializeTraceContext(traceContext: TraceContext)

Serialize the given trace context into a Buffer.

Parameters :
Name Type Optional Description
traceContext TraceContext No

The trace context to serialize.

Returns : Buffer
truncate
truncate(str: string, length: number)

Truncates the provided string to be at most length bytes after utf8 encoding and the appending of '...'. We produce the result by iterating over input characters to avoid truncating the string potentially producing partial unicode characters at the end.

Parameters :
Name Type Optional
str string No
length number No

src/plugins/plugin-http2.ts

extractMethodName
extractMethodName(headers?)
Parameters :
Name Optional
headers Yes
Returns : string
extractPath
extractPath(headers?)
Parameters :
Name Optional
headers Yes
Returns : string
extractUrl
extractUrl(authority, headers?)
Parameters :
Name Optional
authority No
headers Yes
Returns : string
getSpanName
getSpanName(authority)
Parameters :
Name Optional
authority No
Returns : string
isTraceAgentRequest
isTraceAgentRequest(headers, api: Tracer)
Parameters :
Name Type Optional
headers No
api Tracer No
Returns : boolean
makeRequestTrace
makeRequestTrace(request: Http2SessionRequestFunction, authority, api: Tracer)
Parameters :
Name Type Optional
request Http2SessionRequestFunction No
authority No
api Tracer No
patchHttp2
patchHttp2(h2: Http2Module, api: Tracer)
Parameters :
Name Type Optional
h2 Http2Module No
api Tracer No
Returns : void
patchHttp2Session
patchHttp2Session(session, authority, api: Tracer)
Parameters :
Name Type Optional
session No
authority No
api Tracer No
Returns : void
unpatchHttp2
unpatchHttp2(h2: Http2Module)
Parameters :
Name Type Optional
h2 Http2Module No

src/plugins/plugin-http.ts

extractUrl
extractUrl(options, fallbackProtocol: string)
Parameters :
Name Type Optional
options No
fallbackProtocol string No
getSpanName
getSpanName(options)
Parameters :
Name Optional
options No
hasExpectHeader
hasExpectHeader(options)

Returns whether the Expect header is on the given options object. Assumes only that the header key is either capitalized, lowercase, or all-caps for simplicity purposes.

Parameters :
Name Optional Description
options No

Options for http.request.

Returns : boolean
isTraceAgentRequest
isTraceAgentRequest(options, api: Tracer)
Parameters :
Name Type Optional
options No
api Tracer No
makeRequestTrace
makeRequestTrace(protocol: string, request: RequestFunction, api: Tracer)
Parameters :
Name Type Optional
protocol string No
request RequestFunction No
api Tracer No
Returns : RequestFunction
patchHttp
patchHttp(http: HttpModule, api: Tracer)
Parameters :
Name Type Optional
http HttpModule No
api Tracer No
patchHttps
patchHttps(https: HttpsModule, api: Tracer)
Parameters :
Name Type Optional
https HttpsModule No
api Tracer No
unpatchHttp
unpatchHttp(http: HttpModule)
Parameters :
Name Type Optional
http HttpModule No
unpatchHttps
unpatchHttps(https: HttpsModule)
Parameters :
Name Type Optional
https HttpsModule No
urlToOptions
urlToOptions(url: URL)
Parameters :
Name Type Optional
url URL No
Returns : httpModule.RequestOptions

src/index.ts

get
get()

Get the previously created StackdriverTracer object.

Returns : PluginTypes.Tracer

An object exposing functions for creating custom spans.

initConfig
initConfig(userConfig: Forceable)

Normalizes the user-provided configuration object by adding default values and overriding with env variables when they are provided.

Parameters :
Name Type Optional Description
userConfig Forceable No

The user-provided configuration object. It will not be modified.

Returns : TopLevelConfig

A normalized configuration object.

start
start(config?: Config)

Start the Stackdriver Trace Agent with the given configuration (if provided). This function should only be called once, and before any other modules are loaded.

Parameters :
Name Type Optional Description
config Config Yes

A configuration object.

Example :
trace.start();
Returns : PluginTypes.Tracer

An object exposing functions for creating custom spans.

src/plugins/plugin-hapi.ts

instrument
instrument(api, request, continueCb)
Parameters :
Name Optional
api No
request No
continueCb No
Returns : T

src/logger.ts

logLevelToName
logLevelToName(level?: number)
Parameters :
Name Type Optional
level number Yes
Returns : LogLevel

src/plugins/plugin-grpc.ts

patchClient
patchClient(client: ClientModule, api: Tracer)
Parameters :
Name Type Optional
client ClientModule No
api Tracer No
patchMetadata
patchMetadata(metadata: MetadataModule)
Parameters :
Name Type Optional
metadata MetadataModule No
patchServer
patchServer(server: ServerModule, api: Tracer)
Parameters :
Name Type Optional
server ServerModule No
api Tracer No
unpatchClient
unpatchClient(client: ClientModule)
Parameters :
Name Type Optional
client ClientModule No
unpatchMetadata
unpatchMetadata()
unpatchServer
unpatchServer(server: ServerModule)
Parameters :
Name Type Optional
server ServerModule No

src/plugins/plugin-express.ts

patchModuleRoot
patchModuleRoot(express: Express4Module, api)
Parameters :
Name Type Optional
express Express4Module No
api No
unpatchModuleRoot
unpatchModuleRoot(express: Express4Module)
Parameters :
Name Type Optional
express Express4Module No

src/plugins/plugin-restify.ts

patchRestify
patchRestify(restify: Restify5, api)
Parameters :
Name Type Optional
restify Restify5 No
api No
unpatchRestify
unpatchRestify(restify: Restify5)
Parameters :
Name Type Optional
restify Restify5 No

src/plugins/plugin-pg.ts

populateLabelsFromInputs
populateLabelsFromInputs(span: Span, args: ClientQueryArguments)
Parameters :
Name Type Optional
span Span No
args ClientQueryArguments No
populateLabelsFromOutputs
populateLabelsFromOutputs(span: Span, err, res?)
Parameters :
Name Type Optional
span Span No
err No
res Yes

results matching ""

    No results matching ""