Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
},
value: 'test',
}
},
fetchUnion(): CommonUnion {
return CommonUnionCodec.create({ option1: 'test' })
},
broken(): void {
throw new Error(`Yeah, this didn't work`)
},
})
/**
* Creates Hapi server with thrift endpoint.
*/
const server: Hapi.Server = await createThriftServer({
port: HAPI_CALC_SERVER_STRICT_CONFIG.port,
path: HAPI_CALC_SERVER_STRICT_CONFIG.path,
thriftOptions: {
serviceName: 'calculator-service',
handler: impl,
protocol: protocolType,
},
})
if (sampleRate > 0) {
await server.register({
plugin: ZipkinTracingHapi({
localServiceName: 'calculator-service',
tracerConfig: {
endpoint: process.env.ZIPKIN_ENDPOINT,
zipkinVersion:
const impl = new AddService.Processor({
ping(): void {
return
},
add(a: number, b: number, context?: Hapi.Request): number {
return a + b
},
addInt64(a: Int64, b: Int64, context?: Hapi.Request): Int64 {
return new Int64(a.toNumber() + b.toNumber())
},
})
/**
* Creates Hapi server with thrift endpoint.
*/
const server: Hapi.Server = await createThriftServer({
port: SERVER_CONFIG.port,
path: SERVER_CONFIG.path,
thriftOptions: {
serviceName: 'add-service',
handler: impl,
},
})
await server.register({
plugin: ZipkinTracingHapi({
localServiceName: 'add-service',
tracerConfig: {
endpoint: 'http://localhost:9411/api/v1/spans',
sampleRate: 1.0,
httpInterval: 1000,
httpTimeout: 5000,
return thriftClient.add(work.num1, work.num2, {
headers: context.headers,
})
case Operation.SUBTRACT:
return work.num1 - work.num2
case Operation.DIVIDE:
return work.num1 / work.num2
case Operation.MULTIPLY:
return work.num1 * work.num2
default:
throw new Error(`Invalid operation[${work.op}]`)
}
},
})
const server: Hapi.Server = await createThriftServer({
port: SERVER_CONFIG.port,
path: SERVER_CONFIG.path,
thriftOptions: {
serviceName: 'calculator-service',
handler: impl,
},
})
await server.register({
plugin: ZipkinTracingHapi({
localServiceName: 'calculator-service',
tracerConfig: {
endpoint: 'http://localhost:9411/api/v1/spans',
httpInterval: 1000,
httpTimeout: 5000,
sampleRate: 1.0,
const impl = new AddService.Processor({
ping(): void {
return
},
add(a: number, b: number, context?: Hapi.Request): number {
return a + b
},
addInt64(a: Int64, b: Int64, context?: Hapi.Request): Int64 {
return new Int64(a.toNumber() + b.toNumber())
},
})
/**
* Creates Hapi server with thrift endpoint.
*/
const server: Hapi.Server = await createThriftServer({
port: ADD_SERVER_CONFIG.port,
path: ADD_SERVER_CONFIG.path,
thriftOptions: {
serviceName: 'add-service',
handler: impl,
},
})
if (sampleRate > 0) {
await server.register({
plugin: ZipkinTracingHapi({
localServiceName: 'add-service',
tracerConfig: {
endpoint: process.env.ZIPKIN_ENDPOINT,
zipkinVersion:
process.env.ZIPKIN_VERSION === 'v2' ? 'v2' : 'v1',
},
value: 'test',
}
},
fetchUnion(): ICommonUnionArgs {
return { option1: 'test' }
},
broken(): void {
throw new Error(`Yeah, this didn't work`)
},
})
/**
* Creates Hapi server with thrift endpoint.
*/
const server: Hapi.Server = await createThriftServer({
port: HAPI_CALC_SERVER_CONFIG.port,
path: HAPI_CALC_SERVER_CONFIG.path,
thriftOptions: {
serviceName: 'calculator-service',
handler: impl,
protocol: protocolType,
},
})
if (sampleRate > 0) {
await server.register({
plugin: ZipkinTracingHapi({
localServiceName: 'calculator-service',
tracerConfig: {
endpoint: process.env.ZIPKIN_ENDPOINT,
zipkinVersion: