-
Notifications
You must be signed in to change notification settings - Fork 1
feat(observability): add structured logging #51
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
base: main
Are you sure you want to change the base?
Conversation
| * | ||
| * @example | ||
| * ```typescript | ||
| * import { ValidationError, AuthenticationError } from "@databricks/appkit"; |
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.
if this is what we want to do, we are missing all the error exports in the root index file 😄
pkosiec
left a comment
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.
Nice job overall! A few comments from my side
| resource: this.createResource(config), | ||
| autoDetectResources: false, | ||
| sampler: new AlwaysOnSampler(), | ||
| sampler: new AppKitSampler(), |
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.
Could you please test a deployed app with OpenTelemetry enabled in Apps runtime? I think it would be great to double-check everything works flawlessly there 👍
From my observations sampling result might differ between local dev and runtime, that's why the AlwaysOnSampler was set before (same as previous default OpenTelemetry config).
Summary
WideEventclass for collecting rich request metadata (method, path, user, component, execution, stream, error context)AsyncLocalStoragefor automatic context propagation across interceptors and nested callsDetails
Standardized Errors
New error hierarchy with
AppKitErrorbase class providing:code,statusCode,isRetryable)ValidationError,AuthenticationError,ConfigurationError,ConnectionError,ExecutionError,InitializationError,ServerError,TunnelErrortoJSON()serializationValidationError.missingField("warehouseId"))Structured Logging
createLogger(scope)returns a logger with:logger.info(req, "Processing %s", id)tracks logs in WideEventlogger.event(req?)returns the current WideEvent (from AsyncLocalStorage or explicit req)Wide-Event Tracking (Honeycomb-style)
Request-scoped
WideEventcollects:Sampling
Configurable via
APPKIT_SAMPLE_RATEenv var with smart defaults: