forked from honeycombio/beeline-nodejs
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add types for two internal functions (#4)
Adds type declarations for `deterministicSampler` and `getTraceContext` that we intend to import from our TypeScript wrapper libraries.
- Loading branch information
1 parent
bc7ad0e
commit 3dacf6f
Showing
3 changed files
with
18 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { SamplerResponse } from "./types"; | ||
|
||
// Note that this is more specific than upstream `types.d.ts`. They define the | ||
// samplerHook function's argument as `event: unknown`. We're more opinionated. | ||
interface SamplerFn { | ||
(data: {[key: string]: any}): SamplerResponse; | ||
} | ||
|
||
export default function(sampleRate: number) : SamplerFn; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import { IncomingMessage } from 'http'; | ||
import { TraceContext } from '../types'; | ||
|
||
// TODO: There are lots more functions exported by this file. We did not bother | ||
// to declare types for all of them, but we should, if we decide that we need to | ||
// `import` them into TypeScript projects. | ||
|
||
export function getTraceContext(traceIdSource: any, req: IncomingMessage): TraceContext |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters