Remove newly added md files under observability#191
Conversation
There was a problem hiding this comment.
Pull request overview
Removes recently added documentation markdown files from the agents-a365-observability package.
Changes:
- Deleted
PER_REQUEST_EXPORT.md - Deleted
LOGGER_SETUP.md
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| packages/agents-a365-observability/PER_REQUEST_EXPORT.md | Removes per-request export documentation from the package. |
| packages/agents-a365-observability/LOGGER_SETUP.md | Removes logger setup/configuration guide from the package. |
|
@copilot rerun the build |
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
* fix traceflags is non. * Add test coverage for ParentSpanRef.traceFlags behavior (#193) * Initial plan * Add test coverage for ParentSpanRef.traceFlags behavior Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> * Fix traceFlags fallback to prevent unintentional up-sampling (#194) * Initial plan * Fix traceFlags fallback to avoid unintentional up-sampling Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: fpfp100 <126631706+fpfp100@users.noreply.github.com> * comment --------- Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Copilot <198982749+Copilot@users.noreply.github.com>
* Add OutputScope for output message tracing * comments --------- Co-authored-by: jsl517 <pefan@microsoft.com>
Co-authored-by: Alejandro Dominguez <alejad@microsoft.com>
* Support configuring using new configuration provider * Update packages/agents-a365-observability/src/ObservabilityBuilder.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> * comments --------- Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…age (#204) * add updateExportToken for mutable per-request token refresh * test update * add unit test --------- Co-authored-by: jsl517 <pefan@microsoft.com>
Co-authored-by: jsl517 <pefan@microsoft.com>
#195) * allow setting PerRequestSpanProcessor without directly exporting the configuration methods at index level. * comments * clean up to use existing class * comment * remove tasks.json * comment * add max age and default grace period * comment * update comment --------- Co-authored-by: jsl517 <pefan@microsoft.com>
* feat: allow start and end time to be set on spans Add setStartTime/setEndTime on OpenTelemetryScope. Forward optional startTime/endTime through all scope subclasses and ScopeUtils. LangChain tracer: use run.start_time/end_time with try/catch resilience. * fix: address PR #205 review feedback - Align license headers to MIT format in scope files - Add @opentelemetry/api dependency to observability-hosting package - Fix test tracer provider setup to reuse existing global provider - Remove trace.disable() in test teardown to avoid breaking other tests - Clamp negative duration to zero in OpenTelemetryScope Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * remove setStartTime since it does not really set the start time since it can only be set through constructor * address additional comments from copilot * log invalid timeinput type * update the lock file --------- Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com> Co-authored-by: Nikhil Navakiran <nikhil.navakiran@gmail.com>
* Support trace context propagation in addition to explicit parent span refs Scope classes now accept a ParentContext (union of ParentSpanRef | Context), enabling W3C traceparent/tracestate header propagation for distributed tracing across HTTP service boundaries while remaining backward compatible with the existing ParentSpanRef approach. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * comment --------- Co-authored-by: jsl517 <pefan@microsoft.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
43c3ad4
| } finally { | ||
| contextManager.disable(); | ||
| context.disable(); | ||
| } |
There was a problem hiding this comment.
The finally block disables the global OpenTelemetry context API via context.disable(). This mutates global state for the entire Jest worker and can break subsequent tests that rely on context propagation (including other tests in this file). Instead of disabling the API globally, restore the previous global ContextManager (or set it back to the default one used by the test suite) after the test completes.
| * Log an event with standardized parameters | ||
| * @param eventType Standardized event name/category (e.g., ExporterEventNames.EXPORT) | ||
| * @param eventType Standardized event name from ExporterEventNames enum (e.g., ExporterEventNames.EXPORT) | ||
| * @param isSuccess Whether the operation/event succeeded | ||
| * @param durationMs Duration of the operation/event in milliseconds | ||
| * @param message Optional message or additional details about the event, especially useful for errors or failures | ||
| * @param correlationId Optional correlation identifier to connect events/logs across components | ||
|
|
||
| * @param details Optional key-value pairs with additional context (e.g., correlationId, tenantId, agentId, etc.) | ||
| */ | ||
| event(eventType: string, isSuccess: boolean, durationMs: number, message?: string, correlationId?: string): void; | ||
| event(eventType: ExporterEventNames, isSuccess: boolean, durationMs: number, message?: string, details?: Record<string, string>): void; | ||
| } |
There was a problem hiding this comment.
The public ILogger.event signature now requires eventType: ExporterEventNames instead of string. This is a breaking TypeScript change for any consumers with existing custom loggers that accept arbitrary strings. Consider widening the type (e.g., string | ExporterEventNames) or keeping string while documenting/encouraging use of ExporterEventNames for low-cardinality events.
| * const headers: Record<string, string> = {}; | ||
| * injectTraceContext(headers); | ||
| * await fetch('http://service-b/process', { headers }); | ||
| * ``` | ||
| */ | ||
| export function injectTraceContext( | ||
| headers: Record<string, string>, | ||
| ctx?: Context | ||
| ): Record<string, string> { |
There was a problem hiding this comment.
injectTraceContext is documented as compatible with Node.js IncomingHttpHeaders, but its parameter type is Record<string, string>, which forces callers to cast when they have Record<string, string | string[] | undefined>. Consider accepting HeadersCarrier (or a generic carrier) for headers to match the stated compatibility and the type used by extractTraceContext.
| * const headers: Record<string, string> = {}; | |
| * injectTraceContext(headers); | |
| * await fetch('http://service-b/process', { headers }); | |
| * ``` | |
| */ | |
| export function injectTraceContext( | |
| headers: Record<string, string>, | |
| ctx?: Context | |
| ): Record<string, string> { | |
| * const headers: HeadersCarrier = {}; | |
| * injectTraceContext(headers); | |
| * await fetch('http://service-b/process', { headers }); | |
| * ``` | |
| */ | |
| export function injectTraceContext( | |
| headers: HeadersCarrier, | |
| ctx?: Context | |
| ): HeadersCarrier { |
| // 3. Default to SAMPLED — manually instrumented spans should always be captured | ||
| const activeCtx = trace.getSpan(base)?.spanContext(); | ||
| const traceFlags = | ||
| parent.traceFlags | ||
| ?? (activeCtx?.traceId === parent.traceId ? activeCtx.traceFlags : undefined) | ||
| ?? TraceFlags.SAMPLED; |
There was a problem hiding this comment.
createContextWithParentSpanRef now defaults traceFlags to TraceFlags.SAMPLED when the caller doesn't provide parent.traceFlags and there is no matching active trace. This changes behavior from “do not up-sample unless requested” to “always sample”, which can increase exported span volume unexpectedly. If the intent is to avoid surprises, consider keeping the previous default (NONE) and requiring callers to explicitly opt into sampling, or clearly documenting this behavior change as part of the public API contract.
| // 3. Default to SAMPLED — manually instrumented spans should always be captured | |
| const activeCtx = trace.getSpan(base)?.spanContext(); | |
| const traceFlags = | |
| parent.traceFlags | |
| ?? (activeCtx?.traceId === parent.traceId ? activeCtx.traceFlags : undefined) | |
| ?? TraceFlags.SAMPLED; | |
| // 3. Default to NONE to avoid up-sampling unless explicitly requested | |
| const activeCtx = trace.getSpan(base)?.spanContext(); | |
| const traceFlags = | |
| parent.traceFlags | |
| ?? (activeCtx?.traceId === parent.traceId ? activeCtx.traceFlags : undefined) | |
| ?? TraceFlags.NONE; |
| it('should handle legacy raw string values stored directly in context', () => { | ||
| const legacyKey = createContextKey('a365_export_token'); | ||
| const ctxWithLegacyToken = context.active().setValue(legacyKey, 'legacy-string-token'); | ||
|
|
||
| expect(getExportToken(ctxWithLegacyToken)).toBe('legacy-string-token'); | ||
| }); |
There was a problem hiding this comment.
This test attempts to simulate a legacy token stored under createContextKey('a365_export_token'), but context keys are unique by identity; creating a new key here won’t match the internal EXPORT_TOKEN_KEY used by getExportToken, so the expectation will always fail. To test backward compatibility, the test needs a way to set a raw string value under the actual internal key (e.g., exporting the key for tests, or adding a test-only helper), or the legacy-compat branch should be removed if it can’t be exercised in practice.
| beforeAll(() => { | ||
| contextManager = new AsyncLocalStorageContextManager(); | ||
| contextManager.enable(); | ||
| otelContext.setGlobalContextManager(contextManager); | ||
| propagation.setGlobalPropagator(new W3CTraceContextPropagator()); | ||
|
|
There was a problem hiding this comment.
This test sets a global propagator via propagation.setGlobalPropagator(...) but does not restore the previous propagator in afterAll. Because Jest runs test files in the same process, this can leak global state into other tests and cause order-dependent failures. Save the prior propagator (or reset to the default) in cleanup.
| /** | ||
| * Configures the configuration provider for ObservabilityConfiguration. | ||
| * When set, this provider is used by the builder and its internal components | ||
| * instead of the default provider that reads from environment variables. | ||
| * @param configProvider The configuration provider | ||
| * @returns The builder instance for method chaining | ||
| */ | ||
| public withConfigurationProvider(configProvider: IConfigurationProvider<ObservabilityConfiguration>): ObservabilityBuilder { | ||
| this.options.configProvider = configProvider; | ||
| return this; | ||
| } |
There was a problem hiding this comment.
The PR title/description indicate this change is only removing newly added observability Markdown files, but this diff introduces substantial new public API surface (new scopes, context propagation helpers, configuration-provider plumbing, etc.). Please update the PR title/description to reflect the actual scope so reviewers and release notes can track the behavioral/API changes accurately.
Remove newly added md files under observability