Skip to content

Make Client instance available to instrumentation.#12

Merged
dot-agi merged 2 commits intomainfrom
client-dependency
Jun 18, 2025
Merged

Make Client instance available to instrumentation.#12
dot-agi merged 2 commits intomainfrom
client-dependency

Conversation

@tcdent
Copy link
Collaborator

@tcdent tcdent commented Jun 9, 2025

Dependency inject our client instance into instrumentation.

Previously, we were passing the serviceName and serviceVersion up as arguments, so this makes it easier to get it straight from the Config when we need it.

Also useful to have the client available in the instrumentors for things like log export where we need to connect to the API.

@tcdent tcdent requested a review from Copilot June 11, 2025 19:43
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

This PR enables dependency injection of the Client instance into the instrumentation system, allowing instrumentors to access configuration and API capabilities directly.

  • The InstrumentationRegistry now accepts a Client instance and constructs instrumentor instances with it.
  • The InstrumentationBase constructor has been updated to receive the Client and pass along its configuration.
  • The Client now passes itself into the InstrumentationRegistry and updates the retrieval of active instrumentors accordingly.

Reviewed Changes

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

File Description
src/instrumentation/registry.ts Updated to inject Client into instrumentors and remove obsolete parameters
src/instrumentation/base.ts Modified constructor to receive Client and initialize via Client properties
src/client.ts Adjusted registry instantiation and updated access to instrumentation
Comments suppressed due to low confidence (1)

src/instrumentation/registry.ts:97

  • Ensure that all instrumentor classes have been updated to accept a single Client parameter in their constructors for consistent dependency injection.
const instance = new (instrumentorClass as any)(this.client);

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy link
Member

@dot-agi dot-agi left a comment

Choose a reason for hiding this comment

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

LGTM 🚀

@dot-agi dot-agi merged commit ae78d62 into main Jun 18, 2025
1 check passed
@dot-agi dot-agi deleted the client-dependency branch June 18, 2025 16:07
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.

3 participants