@middleware.io/agent-apm-worker-test
TypeScript icon, indicating that this package has built-in type declarations

0.0.667 • Public • Published

Agent APM for Cloudflare Workers

import { init,track } from '@middleware.io/agent-apm-worker';

export default {
	async fetch(
		request: Request,
		ctx: ExecutionContext
	): Promise<Response> {

		init({
			projectName:"{APM-PROJECT-NAME}",
			serviceName:"{APM-SERVICE-NAME}",
			accountKey:"{ACCOUNT_KEY}",
			target:"https://{ACCOUNT-UID}.middleware.io"
		})
		
		const sdk = track(request, ctx);
		const url = new URL(request.url);
		const response = await sdk.fetch(`https://httpbin.org${url.pathname}`);
		return sdk.sendResponse(response);
	},
};

Readme

Keywords

none

Package Sidebar

Install

npm i @middleware.io/agent-apm-worker-test

Weekly Downloads

0

Version

0.0.667

License

ISC

Unpacked Size

19.5 kB

Total Files

10

Last publish

Collaborators

  • middleware-dev
  • meghraj-middleware