Skip to content

Commit

Permalink
[Profiling] Divide into more packages
Browse files Browse the repository at this point in the history
With this commit we split the Universal Profiling plugin into three
packages:

* `persistence` contains everything w.r.t index management
* `rest` contains the REST API
* `action` contains the transport API

The `action` / `rest` structure follows the already established
structure in the rest of the code base. We divide this plugin into
multiple packages mainly because the different functionalities will be
maintained by different teams in the future. This restructuring helps
clarify boundaries.
  • Loading branch information
danielmitterdorfer committed Apr 8, 2024
1 parent 29888ff commit feac3e5
Show file tree
Hide file tree
Showing 80 changed files with 151 additions and 108 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

public class GetFlameGraphActionIT extends ProfilingTestCase {
public void testGetStackTracesUnfiltered() throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.core.TimeValue;
import org.elasticsearch.rest.RestStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.index.query.BoolQueryBuilder;
import org.elasticsearch.index.query.QueryBuilders;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.common.settings.Settings;
import org.elasticsearch.xpack.core.LocalStateCompositeXPackPlugin;
import org.elasticsearch.xpack.profiling.ProfilingPlugin;

import java.nio.file.Path;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsRequest;
import org.elasticsearch.action.admin.cluster.settings.ClusterUpdateSettingsResponse;
Expand All @@ -25,6 +25,8 @@
import org.elasticsearch.xpack.core.ilm.LifecycleSettings;
import org.elasticsearch.xpack.countedkeyword.CountedKeywordMapperPlugin;
import org.elasticsearch.xpack.ilm.IndexLifecycle;
import org.elasticsearch.xpack.profiling.ProfilingPlugin;
import org.elasticsearch.xpack.profiling.persistence.ProfilingIndexManager;
import org.elasticsearch.xpack.unsignedlong.UnsignedLongMapperPlugin;
import org.elasticsearch.xpack.versionfield.VersionFieldPlugin;
import org.junit.After;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,25 @@
import org.elasticsearch.xpack.core.XPackSettings;
import org.elasticsearch.xpack.core.action.XPackInfoFeatureAction;
import org.elasticsearch.xpack.core.action.XPackUsageFeatureAction;
import org.elasticsearch.xpack.profiling.action.GetFlamegraphAction;
import org.elasticsearch.xpack.profiling.action.GetStackTracesAction;
import org.elasticsearch.xpack.profiling.action.GetStatusAction;
import org.elasticsearch.xpack.profiling.action.GetTopNFunctionsAction;
import org.elasticsearch.xpack.profiling.action.ProfilingInfoTransportAction;
import org.elasticsearch.xpack.profiling.action.ProfilingLicenseChecker;
import org.elasticsearch.xpack.profiling.action.ProfilingUsageTransportAction;
import org.elasticsearch.xpack.profiling.action.TransportGetFlamegraphAction;
import org.elasticsearch.xpack.profiling.action.TransportGetStackTracesAction;
import org.elasticsearch.xpack.profiling.action.TransportGetStatusAction;
import org.elasticsearch.xpack.profiling.action.TransportGetTopNFunctionsAction;
import org.elasticsearch.xpack.profiling.persistence.IndexStateResolver;
import org.elasticsearch.xpack.profiling.persistence.ProfilingDataStreamManager;
import org.elasticsearch.xpack.profiling.persistence.ProfilingIndexManager;
import org.elasticsearch.xpack.profiling.persistence.ProfilingIndexTemplateRegistry;
import org.elasticsearch.xpack.profiling.rest.RestGetFlamegraphAction;
import org.elasticsearch.xpack.profiling.rest.RestGetStackTracesAction;
import org.elasticsearch.xpack.profiling.rest.RestGetStatusAction;
import org.elasticsearch.xpack.profiling.rest.RestGetTopNFunctionsAction;

import java.util.ArrayList;
import java.util.Collection;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.core.UpdateForV9;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import java.util.Map;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

public record Frame(String fileName, String functionName, int functionOffset, int lineNumber, boolean inline, boolean last) {}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.common.Strings;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.TransportAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionRequest;
import org.elasticsearch.action.ActionRequestValidationException;
Expand All @@ -19,6 +19,7 @@
import org.elasticsearch.tasks.TaskId;
import org.elasticsearch.xcontent.ParseField;
import org.elasticsearch.xcontent.XContentParser;
import org.elasticsearch.xpack.profiling.persistence.EventsIndex;

import java.io.IOException;
import java.util.ArrayList;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.TransportAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import java.time.Instant;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.ActionType;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* 2.0; you may not use this file except in compliance with the Elastic License
* 2.0.
*/
package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionResponse;
import org.elasticsearch.action.support.TransportAction;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.ToXContentObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.cluster.ClusterState;
import org.elasticsearch.cluster.metadata.IndexMetadata;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.core.UpdateForV9;
import org.elasticsearch.xcontent.ToXContentObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

final class NumberUtils {
private NumberUtils() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.support.ActionFilters;
import org.elasticsearch.common.inject.Inject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.license.License;
import org.elasticsearch.license.LicenseUtils;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.action.ActionListener;
import org.elasticsearch.action.support.ActionFilters;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import java.util.Random;
import java.util.random.RandomGenerator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.xcontent.ObjectPath;
import org.elasticsearch.xcontent.ToXContentObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

/**
* Measures time and logs it in milliseconds.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.elasticsearch.xcontent.ToXContentObject;
import org.elasticsearch.xcontent.XContentBuilder;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import java.util.HashMap;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 2.0.
*/

package org.elasticsearch.xpack.profiling;
package org.elasticsearch.xpack.profiling.action;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
Expand Down
Loading

0 comments on commit feac3e5

Please sign in to comment.