Skip to content

fix(grape): detect code namespace for API instance endpoints#2407

Open
bdewater-thatch wants to merge 1 commit into
open-telemetry:mainfrom
thatch-health:fix-grape-code-namespace-for-instance-api
Open

fix(grape): detect code namespace for API instance endpoints#2407
bdewater-thatch wants to merge 1 commit into
open-telemetry:mainfrom
thatch-health:fix-grape-code-namespace-for-instance-api

Conversation

@bdewater-thatch

@bdewater-thatch bdewater-thatch commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Direct Grape::API::Instance subclasses expose endpoint.options[:for] as the endpoint class itself rather than a generated mount instance with @base set. The previous instrumentation only read @base, which produced nil and caused the SDK to log invalid code.namespace attribute value errors.

We're subclassing Grape::API::Instance directly because we're using Sorbet in our Rails app, with our grape_sorbet gem for the signatures. The reason it works this way is documented here: https://github.com/thatch-health/grape_sorbet#subclassing-from-grapeapiinstance-instead-of-grapeapi

Direct Grape::API::Instance subclasses expose endpoint.options[:for] as the endpoint class itself rather than a generated mount instance with @base set. The previous instrumentation only read @base, which produced nil and caused the SDK to log invalid code.namespace attribute value errors. Fall back to the owner class name and omit code.namespace when no namespace can be derived.
@bdewater-thatch bdewater-thatch force-pushed the fix-grape-code-namespace-for-instance-api branch from 3b10d39 to fe96ae7 Compare June 17, 2026 18:14
@bdewater-thatch bdewater-thatch changed the title Fix Grape code namespace for API instance endpoints fix(grape): detect code namespace for API instance endpoints Jun 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants