Make Client instance available to instrumentation.#12
Merged
Conversation
Contributor
There was a problem hiding this comment.
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Dependency inject our client instance into instrumentation.
Previously, we were passing the
serviceNameandserviceVersionup 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.