Skip to content

Conversation

ben-fornefeld
Copy link
Member

@ben-fornefeld ben-fornefeld commented Aug 29, 2025

No description provided.

ben-fornefeld and others added 14 commits August 29, 2025 13:07
This PR enhances OpenTelemetry logging by adding comprehensive Vercel
deployment context to improve observability and debugging in serverless
environments.

### Changes
- **Enhanced resource attributes**: Added function to parse
`OTEL_RESOURCE_ATTRIBUTES` environment variable for additional context
- **Vercel environment integration**: Automatically captures and
includes Vercel-specific environment variables in telemetry data:
  - Deployment environment (`VERCEL_ENV`)
- URL configurations (`VERCEL_URL`, `VERCEL_PROJECT_PRODUCTION_URL`,
`VERCEL_BRANCH_URL`)
  - Deployment metadata (`VERCEL_REGION`, `VERCEL_DEPLOYMENT_ID`)
- Git context (`VERCEL_GIT_COMMIT_SHA`, `VERCEL_GIT_COMMIT_MESSAGE`,
`VERCEL_GIT_COMMIT_AUTHOR_NAME`)
- Repository information (`VERCEL_GIT_REPO_SLUG`,
`VERCEL_GIT_REPO_OWNER`, `VERCEL_GIT_PROVIDER`)
- **Environment validation**: Extended `env.ts` schema to validate new
Vercel environment variables
- **Universal support**: Applied changes to both Node.js and Edge
runtime instrumentation

### Impact
Provides richer context in logs and traces, making it easier to:
- Correlate issues with specific deployments and environments
- Debug problems across different Vercel environments (development,
preview, production)
- Track performance and errors by Git commits and deployment metadata
- Improve incident response with better deployment visibility

This enhancement builds upon the existing OpenTelemetry setup while
maintaining backward compatibility and following Vercel's environment
variable conventions.

<!-- START COPILOT CODING AGENT SUFFIX -->



<!-- START COPILOT CODING AGENT TIPS -->
---

💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.

Co-authored-by: copilot-swe-agent[bot] <[email protected]>
The commit changes the logging approach by separating log metadata from
human-readable messages across many files. The key changes are:

- Adds descriptive message text to all log calls - Moves metadata into a
separate object parameter - Consistently structures log keys and
metadata fields - Improves error logging with serialized errors

Subject: Add structured logging with human-readable messages

Body: Enhances logging by separating structured metadata from
human-readable message text. Makes logs more useful for both automated
processing and manual review. Adds consistent error serialization and
metadata structure.
Copy link

vercel bot commented Aug 29, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
web Ready Ready Preview Comment Aug 29, 2025 3:41pm
web-juliett Ready Ready Preview Comment Aug 29, 2025 3:41pm

- Add VercelRuntimeSpanExporter for custom span exporting in Vercel -
Use SimpleLogRecordProcessor instead of BatchLogRecordProcessor -
Disable HTTP instrumentation by default - Enable nodeMiddleware in
next.config.mjs - Upgrade OpenTelemetry core and SDK packages to latest
compatible versions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants