Skip to content

Remove newly added md files under observability#191

Closed
fpfp100 wants to merge 11 commits intomainfrom
users/pefan/rmmd
Closed

Remove newly added md files under observability#191
fpfp100 wants to merge 11 commits intomainfrom
users/pefan/rmmd

Conversation

@fpfp100
Copy link
Contributor

@fpfp100 fpfp100 commented Feb 9, 2026

Remove newly added md files under observability

@fpfp100 fpfp100 requested a review from a team as a code owner February 9, 2026 19:47
Copilot AI review requested due to automatic review settings February 9, 2026 19:47
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

nikhilNava
nikhilNava previously approved these changes Feb 10, 2026
threddy
threddy previously approved these changes Feb 11, 2026
juliomenendez
juliomenendez previously approved these changes Feb 11, 2026
@fpfp100 fpfp100 enabled auto-merge (squash) February 11, 2026 17:21
@fpfp100
Copy link
Contributor Author

fpfp100 commented Feb 11, 2026

@copilot rerun the build

Copy link
Contributor

Copilot AI commented Feb 11, 2026

@fpfp100 I've opened a new pull request, #201, to work on those changes. Once the pull request is ready, I'll request review from you.

Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
@fpfp100 fpfp100 disabled auto-merge February 19, 2026 23:03
fpfp100 and others added 9 commits February 19, 2026 15:11
* 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>
#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>
Copilot AI review requested due to automatic review settings February 19, 2026 23:12
@fpfp100 fpfp100 dismissed stale reviews from nikhilNava, juliomenendez, and threddy via 43c3ad4 February 19, 2026 23:12
@fpfp100 fpfp100 requested a review from a team as a code owner February 19, 2026 23:12
@fpfp100 fpfp100 closed this Feb 19, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 40 out of 41 changed files in this pull request and generated 7 comments.

Comment on lines +292 to +295
} finally {
contextManager.disable();
context.disable();
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines 38 to 46
* 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;
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +54 to +62
* 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> {
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
* 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 {

Copilot uses AI. Check for mistakes.
Comment on lines +67 to +72
// 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;
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Suggested change
// 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;

Copilot uses AI. Check for mistakes.
Comment on lines +45 to +50
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');
});
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +27 to +32
beforeAll(() => {
contextManager = new AsyncLocalStorageContextManager();
contextManager.enable();
otelContext.setGlobalContextManager(contextManager);
propagation.setGlobalPropagator(new W3CTraceContextPropagator());

Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
Comment on lines +109 to +119
/**
* 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;
}
Copy link

Copilot AI Feb 19, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Copilot uses AI. Check for mistakes.
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.

8 participants