-
Notifications
You must be signed in to change notification settings - Fork 141
Workers Observability migrate responses to TSV's #140
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
Changes from all commits
9988c25
6b28bc8
a46d68f
3d6fbc9
a6b5723
d34cf93
9192b6d
e542a3f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import { env } from 'cloudflare:workers' | ||
|
||
import { fetchCloudflareApi } from '../cloudflare-api' | ||
import { | ||
zKeysResponse, | ||
|
@@ -23,6 +25,8 @@ export async function queryWorkersObservability( | |
accountId: string, | ||
query: QueryRunRequest | ||
): Promise<z.infer<typeof zReturnedQueryRunResult> | null> { | ||
// @ts-expect-error We don't have actual env in this package | ||
const environment = env.ENVIRONMENT | ||
const data = await fetchCloudflareApi({ | ||
endpoint: '/workers/observability/telemetry/query', | ||
accountId, | ||
|
@@ -32,6 +36,7 @@ export async function queryWorkersObservability( | |
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json', | ||
'workers-observability-origin': `workers-observability-mcp-${environment}`, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe we can come up with a general header name, which every mcp server uses? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is specific to our backend, happy to add a general one too There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Awesome, maybe we can set our user agent to the server name / version ( the ones pulled from package.json ) Also doesn't have to be in this PR! |
||
}, | ||
body: JSON.stringify({ ...query, timeframe: fixTimeframe(query.timeframe) }), | ||
}, | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We could probably also pass through this env in the params so we don't need to expect error here.
Kinda like what do here https://github.com/cloudflare/mcp-server-cloudflare/blob/main/packages/mcp-common/src/dev-mode.ts#L6
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will fix in a follow up on monday :)