Skip to content

Commit 9945c9a

Browse files
committed
Revert "Expose /v1/integrations/gateway/metrics for Trino Gateway"
This reverts commit 1ca42b4. The endpoint was exposing cluster utilization metrics (memory, load), which are generally useful for observability and also for any other query routing logic. We should expose them in gateway-agnostic manner. Reverting now to unblock release.
1 parent 5c1b62c commit 9945c9a

File tree

8 files changed

+2
-91
lines changed

8 files changed

+2
-91
lines changed

core/trino-main/src/main/java/io/trino/memory/LocalMemoryManager.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,11 @@
1717
import com.google.common.base.Supplier;
1818
import com.google.common.base.Suppliers;
1919
import com.google.inject.Inject;
20-
import com.sun.management.UnixOperatingSystemMXBean;
2120
import io.airlift.units.DataSize;
2221

23-
import java.lang.management.ManagementFactory;
2422
import java.util.concurrent.TimeUnit;
2523

2624
import static com.google.common.base.Verify.verify;
27-
import static java.lang.Math.clamp;
2825
import static java.lang.String.format;
2926

3027
public final class LocalMemoryManager
@@ -34,10 +31,6 @@ public final class LocalMemoryManager
3431
private static final Supplier<Integer> AVAILABLE_PROCESSORS = Suppliers
3532
.memoizeWithExpiration(Runtime.getRuntime()::availableProcessors, 30, TimeUnit.SECONDS);
3633

37-
// Clamp value because according to the documentation: if the recent CPU usage is not available, the method returns a negative value.
38-
private static final Supplier<Double> SYSTEM_CPU_LOAD = Suppliers
39-
.memoizeWithExpiration(() -> clamp(((UnixOperatingSystemMXBean) ManagementFactory.getOperatingSystemMXBean()).getCpuLoad(), 0.0, 1.0), 5, TimeUnit.SECONDS);
40-
4134
@Inject
4235
public LocalMemoryManager(NodeMemoryConfig config)
4336
{
@@ -70,7 +63,7 @@ private void validateHeapHeadroom(NodeMemoryConfig config, long availableMemory)
7063

7164
public MemoryInfo getInfo()
7265
{
73-
return new MemoryInfo(AVAILABLE_PROCESSORS.get(), SYSTEM_CPU_LOAD.get(), memoryPool.getInfo());
66+
return new MemoryInfo(AVAILABLE_PROCESSORS.get(), memoryPool.getInfo());
7467
}
7568

7669
public MemoryPool getMemoryPool()

core/trino-main/src/main/java/io/trino/memory/MemoryInfo.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,14 @@
2323
public class MemoryInfo
2424
{
2525
private final int availableProcessors;
26-
private final double systemCpuLoad;
2726
private final MemoryPoolInfo pool;
2827

2928
@JsonCreator
3029
public MemoryInfo(
3130
@JsonProperty("availableProcessors") int availableProcessors,
32-
@JsonProperty("systemCpuLoad") double systemCpuLoad,
3331
@JsonProperty("pool") MemoryPoolInfo pool)
3432
{
3533
this.availableProcessors = availableProcessors;
36-
this.systemCpuLoad = systemCpuLoad;
3734
this.pool = requireNonNull(pool, "pool is null");
3835
}
3936

@@ -43,12 +40,6 @@ public int getAvailableProcessors()
4340
return availableProcessors;
4441
}
4542

46-
@JsonProperty
47-
public double getSystemCpuLoad()
48-
{
49-
return systemCpuLoad;
50-
}
51-
5243
@JsonProperty
5344
public MemoryPoolInfo getPool()
5445
{
@@ -60,7 +51,6 @@ public String toString()
6051
{
6152
return toStringHelper(this)
6253
.add("availableProcessors", availableProcessors)
63-
.add("systemCpuLoad", systemCpuLoad)
6454
.add("pool", pool)
6555
.toString();
6656
}

core/trino-main/src/main/java/io/trino/server/CoordinatorModule.java

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -242,8 +242,6 @@ protected void setup(Binder binder)
242242

243243
newExporter(binder).export(ClusterMemoryManager.class).withGeneratedName();
244244

245-
jaxrsBinder(binder).bind(GatewayResource.class);
246-
247245
// node partitioning manager
248246
binder.bind(NodePartitioningManager.class).in(Scopes.SINGLETON);
249247

core/trino-main/src/main/java/io/trino/server/GatewayResource.java

Lines changed: 0 additions & 67 deletions
This file was deleted.

core/trino-main/src/test/java/io/trino/execution/scheduler/faulttolerant/BenchmarkBinPackingNodeAllocator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,6 @@ private MemoryInfo buildWorkerMemoryInfo(DataSize usedMemory, Map<TaskId, DataSi
179179
{
180180
return new MemoryInfo(
181181
4,
182-
0,
183182
new MemoryPoolInfo(
184183
DataSize.of(64, GIGABYTE).toBytes(),
185184
usedMemory.toBytes(),

core/trino-main/src/test/java/io/trino/execution/scheduler/faulttolerant/TestBinPackingNodeAllocator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,6 @@ private MemoryInfo buildWorkerMemoryInfo(DataSize usedMemory, Map<TaskId, DataSi
131131
{
132132
return new MemoryInfo(
133133
4,
134-
0,
135134
new MemoryPoolInfo(
136135
DataSize.of(64, GIGABYTE).toBytes(),
137136
usedMemory.toBytes(),

core/trino-main/src/test/java/io/trino/execution/scheduler/faulttolerant/TestExponentialGrowthPartitionMemoryEstimator.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,6 @@ private MemoryInfo buildWorkerMemoryInfo(DataSize usedMemory)
279279
{
280280
return new MemoryInfo(
281281
4,
282-
0,
283282
new MemoryPoolInfo(
284283
DataSize.of(64, GIGABYTE).toBytes(),
285284
usedMemory.toBytes(),

core/trino-main/src/test/java/io/trino/memory/LowMemoryKillerTestingUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ static List<MemoryInfo> toNodeMemoryInfoList(long memoryPoolMaxBytes, Map<String
7373
ImmutableMap.of(),
7474
tasksMemoryInfoForNode(entry.getKey().getNodeIdentifier(), tasks),
7575
ImmutableMap.of());
76-
result.add(new MemoryInfo(7, 0, memoryPoolInfo));
76+
result.add(new MemoryInfo(7, memoryPoolInfo));
7777
}
7878
return result.build();
7979
}

0 commit comments

Comments
 (0)