Skip to content

Conversation

@fpfp100
Copy link
Contributor

@fpfp100 fpfp100 commented Feb 4, 2026

  1. Logger set up md updated based on feedback and cleaned up content following the LangChain PR.
  2. Add event log support in ILogger and also log events for exporter.
image image

@fpfp100 fpfp100 requested a review from a team as a code owner February 4, 2026 03:37
Copilot AI review requested due to automatic review settings February 4, 2026 03:37
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

Minor cleanup across observability core + LangChain extension, plus documentation updates for logger setup.

Changes:

  • Fix minor formatting/indentation issue in SpanProcessor attribute setting.
  • Update LOGGER_SETUP.md examples to import ILogger, setLogger, and resetLogger from the public package entrypoint.
  • Harden LangChain extension utilities with safer optional chaining and an empty-input guard; align an error message with the actual instrument() API name.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 1 comment.

File Description
packages/agents-a365-observability/src/tracing/processors/SpanProcessor.ts Minor cleanup to correctly align/format attribute setting for operation source.
packages/agents-a365-observability/LOGGER_SETUP.md Documentation updates to use public exports instead of internal source paths.
packages/agents-a365-observability-extensions-langchain/src/Utils.ts Safer attribute extraction (optional chaining) and guard against empty messages in inference preprocessing.
packages/agents-a365-observability-extensions-langchain/src/LangChainTraceInstrumentor.ts Error message corrected to reference instrument() (actual API).

juliomenendez
juliomenendez previously approved these changes Feb 4, 2026
@fpfp100 fpfp100 changed the title Miscellaneous minor cleanup Miscellaneous minor cleanup and add event log support Feb 4, 2026
@fpfp100
Copy link
Contributor Author

fpfp100 commented Feb 4, 2026

@copilot fix test failure FAIL tests/observability/core/custom-logger.test.ts

Copy link
Contributor

Copilot AI commented Feb 4, 2026

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

* Initial plan

* Fix test failure by adding event method to ILogger mocks

- Updated all mock ILogger objects in custom-logger.test.ts to include the event method
- Updated setLogger validation to check for event method
- Updated error message to include event method in validation

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>
Copilot AI review requested due to automatic review settings February 4, 2026 21:40
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 8 out of 9 changed files in this pull request and generated 7 comments.

Comments suppressed due to low confidence (1)

packages/agents-a365-observability/LOGGER_SETUP.md:244

  • The custom logger examples are missing the event method, which is now a required part of the ILogger interface. These examples will fail at runtime because they don't implement the complete interface. Add the event method to both logger examples.
if (process.env.NODE_ENV === 'production') {
  setLogger({
    info: (msg, ...args) => console.log(`[Prod-INFO] ${msg}`, ...args),
    warn: (msg, ...args) => console.warn(`[Prod-WARN] ${msg}`, ...args),
    error: (msg, ...args) => console.error(`[Prod-ERROR] ${msg}`, ...args)
  });
}

// Development: selective logging (warn and error only)
if (process.env.NODE_ENV === 'development') {
  setLogger({
    info: () => {},
    warn: (msg, ...args) => console.warn(`[Dev-WARN] ${msg}`, ...args),
    error: (msg, ...args) => console.error(`[Dev-ERROR] ${msg}`, ...args)
  });
}

Copilot AI review requested due to automatic review settings February 6, 2026 23:06
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 9 out of 10 changed files in this pull request and generated 7 comments.

Copilot AI review requested due to automatic review settings February 7, 2026 00: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

Copilot reviewed 9 out of 10 changed files in this pull request and generated 5 comments.

Comments suppressed due to low confidence (1)

packages/agents-a365-observability-extensions-langchain/src/Utils.ts:70

  • preprocess can become messages[0] when scope is "inference". Since messages is already validated as an array, messages[0] is typically a single message object (not an array), which makes preprocess?.map(...) undefined and then .filter(...) will throw at runtime. Consider keeping preprocess as an array (e.g., wrap the first element in an array) or branching so .map/.filter only run on arrays.
  const preprocess = getScopeType(run) === "inference" && messages.length > 0 ? messages[0] : messages;
  const processed = preprocess?.map((msg: Record<string, unknown>) => {
      const content = extractMessageContent(msg);
      if (!content) return null;

@fpfp100
Copy link
Contributor Author

fpfp100 commented Feb 7, 2026

@copilot resolve merge conflict

Copy link
Contributor

Copilot AI commented Feb 7, 2026

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

* feat: Add x-ms-agentid header (#183)

Co-authored-by: Johan Broberg <johanb@microsoft.com>

* set gen_ai.caller.agent.type (#187)

Co-authored-by: jsl517 <pefan@microsoft.com>

* fix: update @isaacs/brace-expansion to version 5.0.1 (#181)

Co-authored-by: Johan Broberg <johanb@microsoft.com>

* feat: Add configuration provider interface (#184)

* Add PRD for configuration provider for Agent 365 SDK

* Change to dynamic resolution for configuration settings

* feat: Add configuration provider interface

* Update lock file

* fix: add backward-compatible overloads to GetAgenticUserToken

The scopes parameter was added as required in main branch, which is a
breaking change for existing consumers. This adds overloads to maintain
backward compatibility:

- 3-param signature (deprecated): Uses default MCP platform scope
- 4-param signature: Explicit scopes for better control

Existing code calling GetAgenticUserToken(auth, handler, ctx) will
continue to work, but callers are encouraged to migrate to the explicit
scopes overload for clarity.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify multi-tenant usage patterns for DefaultConfigurationProvider

Added detailed JSDoc explaining:
- The provider creates a single cached configuration instance
- Default module-level providers are singletons
- Two approaches for multi-tenant scenarios:
  1. Dynamic override functions reading from async context (recommended)
  2. Per-tenant provider instances when needed

This clarifies that while the singleton pattern is used, multi-tenancy is
still supported through function-based overrides that resolve at runtime.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* docs: clarify AgenticTokenCache singleton usage and export class

- Added documentation to AgenticTokenCacheInstance explaining it uses
  default configuration and when to create custom instances
- Exported AgenticTokenCache class so consumers can create instances
  with custom IConfigurationProvider for multi-tenant scenarios
- Added class-level documentation with usage example

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

* add utility methods for parsing environment variables in RuntimeConfiguration

* add setLogger and resetLogger tests

* docs: enhance JSDoc comments for RuntimeConfigurationOptions

* docs: update deprecation notices and provide usage examples for environment utility functions

* refactor: update McpToolRegistrationService to use ClaudeToolingConfiguration

* refactor: update McpToolRegistrationService to use specific tooling configurations for LangChain and OpenAI

* refactor: ensure undefined checks for tooling overrides in ToolingConfiguration

* refactor: enhance ObservabilityConfiguration tests for environment variable handling

* refactor: streamline McpToolRegistrationService by removing redundant utility imports and updating server listing logic

* Address review feedback and discrepancies between documentation and code.

* Address additional feedback; add missing tests, improve documentation

* fix: add guardrails comment for PerRequestSpanProcessor default constants

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>

* Initial plan

* Fix test: Add event method to custom logger mocks

---------

Co-authored-by: Johan Broberg <johan@pontemonti.net>
Co-authored-by: Johan Broberg <johanb@microsoft.com>
Co-authored-by: PengF <126631706+fpfp100@users.noreply.github.com>
Co-authored-by: jsl517 <pefan@microsoft.com>
Co-authored-by: Claude Opus 4.5 <noreply@anthropic.com>
Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Copilot AI review requested due to automatic review settings February 7, 2026 02:04
@fpfp100 fpfp100 requested review from a team as code owners February 7, 2026 02:04
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 91 out of 94 changed files in this pull request and generated 1 comment.

Comments suppressed due to low confidence (5)

packages/agents-a365-runtime/src/power-platform-api-discovery.ts:1

  • Changing ClusterCategory from a string-literal union to a string enum is a breaking TypeScript change for consumers who previously passed string literals (e.g. 'prod') into APIs typed as ClusterCategory (notably PowerPlatformApiDiscovery). To preserve backward compatibility, consider either (a) accepting ClusterCategory | string in public APIs and validating/normalizing at runtime, or (b) exporting a separate type ClusterCategoryString = ${ClusterCategory}`` and using that in public API surfaces where strings were previously accepted.
    packages/agents-a365-observability/src/utils/logging.ts:1
  • Adding a new required ILogger.event(...) method is a compile-time breaking change for any existing consumers providing custom loggers (even if they don’t care about events). To keep backward compatibility, consider making event optional on ILogger (e.g., event?: (...) => void) and treating missing event as a no-op, or keep ILogger unchanged and introduce a separate IEventLogger (or adapter wrapper) while still allowing older ILogger implementations in setLogger.
    packages/agents-a365-runtime/src/utility.ts:1
  • jwt.JwtPayload claim values can be non-strings (commonly string | string[] | undefined). The current implementation can return a non-string truthy value (e.g., a string[]), which violates the function’s return type and could lead to invalid header serialization. A concrete fix is to check typeof value === 'string' (and optionally value.trim().length > 0) for each claim before returning, otherwise fall through to ''.
    packages/agents-a365-observability/src/utils/logging.ts:1
  • getEnabledLogLevels() re-parses the log-level string on every info/warn/error/event call, allocating a new Set each time. If logging is frequent, this can add noticeable overhead. Consider caching the parsed Set keyed by the last seen observabilityLogLevel string (e.g., store { lastLevel: string; parsed: Set<number> } on the logger instance), recomputing only when the level string changes. Also, avoid magic numbers in event() by using LOG_LEVELS.info / LOG_LEVELS.error.
    packages/agents-a365-tooling/src/McpToolServerConfigurationService.ts:1
  • The thrown error is generic and loses key debugging context. Consider including actionable details like the authHandlerName and whether scopes were configured (without logging the token). For example, mention the handler name and scopes count/value (scope strings are typically non-secret) and/or suggest checking configuration (mcpPlatformAuthenticationScope) to reduce support time.

@fpfp100 fpfp100 merged commit 35c46a2 into main Feb 9, 2026
7 checks passed
@fpfp100 fpfp100 deleted the users/pefan/cleanup branch February 9, 2026 17:48
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.

7 participants