-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Adds support to inject telemetry instances to plugins #13636
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
reta
merged 3 commits into
opensearch-project:main
from
Gaganjuneja:add-telemery-service
May 17, 2024
Merged
Changes from all commits
Commits
Show all changes
3 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
80 changes: 80 additions & 0 deletions
80
server/src/main/java/org/opensearch/plugins/TelemetryAwarePlugin.java
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,80 @@ | ||
| /* | ||
| * SPDX-License-Identifier: Apache-2.0 | ||
| * | ||
| * The OpenSearch Contributors require contributions made to | ||
| * this file be licensed under the Apache-2.0 license or a | ||
| * compatible open source license. | ||
| */ | ||
|
|
||
| package org.opensearch.plugins; | ||
|
|
||
| import org.opensearch.client.Client; | ||
| import org.opensearch.cluster.metadata.IndexNameExpressionResolver; | ||
| import org.opensearch.cluster.service.ClusterService; | ||
| import org.opensearch.common.annotation.ExperimentalApi; | ||
| import org.opensearch.common.lifecycle.LifecycleComponent; | ||
| import org.opensearch.core.common.io.stream.NamedWriteable; | ||
| import org.opensearch.core.common.io.stream.NamedWriteableRegistry; | ||
| import org.opensearch.core.xcontent.NamedXContentRegistry; | ||
| import org.opensearch.env.Environment; | ||
| import org.opensearch.env.NodeEnvironment; | ||
| import org.opensearch.repositories.RepositoriesService; | ||
| import org.opensearch.script.ScriptService; | ||
| import org.opensearch.telemetry.metrics.MetricsRegistry; | ||
| import org.opensearch.telemetry.tracing.Tracer; | ||
| import org.opensearch.threadpool.ThreadPool; | ||
| import org.opensearch.watcher.ResourceWatcherService; | ||
|
|
||
| import java.util.Collection; | ||
| import java.util.Collections; | ||
| import java.util.function.Supplier; | ||
|
|
||
| /** | ||
| * Plugin that provides the telemetry registries to build component with telemetry and also provide a way to | ||
| * pass telemetry registries to the implementing plugins for adding instrumentation in the code. | ||
| * | ||
| * @opensearch.experimental | ||
| */ | ||
| @ExperimentalApi | ||
| public interface TelemetryAwarePlugin { | ||
reta marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
|
||
| /** | ||
| * Returns components added by this plugin. | ||
| * <p> | ||
| * Any components returned that implement {@link LifecycleComponent} will have their lifecycle managed. | ||
| * Note: To aid in the migration away from guice, all objects returned as components will be bound in guice | ||
| * to themselves. | ||
| * | ||
| * @param client A client to make requests to the system | ||
| * @param clusterService A service to allow watching and updating cluster state | ||
| * @param threadPool A service to allow retrieving an executor to run an async action | ||
| * @param resourceWatcherService A service to watch for changes to node local files | ||
| * @param scriptService A service to allow running scripts on the local node | ||
| * @param xContentRegistry the registry for extensible xContent parsing | ||
| * @param environment the environment for path and setting configurations | ||
| * @param nodeEnvironment the node environment used coordinate access to the data paths | ||
| * @param namedWriteableRegistry the registry for {@link NamedWriteable} object parsing | ||
| * @param indexNameExpressionResolver A service that resolves expression to index and alias names | ||
| * @param repositoriesServiceSupplier A supplier for the service that manages snapshot repositories; will return null when this method | ||
| * is called, but will return the repositories service once the node is initialized. | ||
| * @param tracer the tracer to add tracing instrumentation. | ||
| * @param metricsRegistry the registry for metrics instrumentation. | ||
| */ | ||
| default Collection<Object> createComponents( | ||
andrross marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| Client client, | ||
| ClusterService clusterService, | ||
| ThreadPool threadPool, | ||
| ResourceWatcherService resourceWatcherService, | ||
| ScriptService scriptService, | ||
| NamedXContentRegistry xContentRegistry, | ||
| Environment environment, | ||
| NodeEnvironment nodeEnvironment, | ||
| NamedWriteableRegistry namedWriteableRegistry, | ||
| IndexNameExpressionResolver indexNameExpressionResolver, | ||
| Supplier<RepositoriesService> repositoriesServiceSupplier, | ||
| Tracer tracer, | ||
| MetricsRegistry metricsRegistry | ||
| ) { | ||
| return Collections.emptyList(); | ||
| } | ||
| } | ||
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
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.
Uh oh!
There was an error while loading. Please reload this page.