-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move NamenodeStats to file system abstraction
- Loading branch information
Showing
16 changed files
with
190 additions
and
197 deletions.
There are no files selected for viewing
This file contains 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 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 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,88 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.hdfs; | ||
|
||
import io.airlift.stats.CounterStat; | ||
import io.airlift.stats.TimeStat; | ||
import org.weakref.jmx.Managed; | ||
import org.weakref.jmx.Nested; | ||
|
||
import java.io.FileNotFoundException; | ||
import java.io.IOException; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
public final class CallStats | ||
{ | ||
private final TimeStat time = new TimeStat(TimeUnit.MILLISECONDS); | ||
private final CounterStat totalCalls = new CounterStat(); | ||
private final CounterStat totalFailures = new CounterStat(); | ||
private final CounterStat ioExceptions = new CounterStat(); | ||
private final CounterStat fileNotFoundExceptions = new CounterStat(); | ||
|
||
public TimeStat.BlockTimer time() | ||
{ | ||
return time.time(); | ||
} | ||
|
||
public void recordException(Exception exception) | ||
{ | ||
if (exception instanceof FileNotFoundException) { | ||
fileNotFoundExceptions.update(1); | ||
} | ||
else if (exception instanceof IOException) { | ||
ioExceptions.update(1); | ||
} | ||
totalFailures.update(1); | ||
} | ||
|
||
@Managed | ||
@Nested | ||
public CounterStat getTotalCalls() | ||
{ | ||
return totalCalls; | ||
} | ||
|
||
@Managed | ||
@Nested | ||
public CounterStat getTotalFailures() | ||
{ | ||
return totalFailures; | ||
} | ||
|
||
@Managed | ||
@Nested | ||
public CounterStat getIoExceptions() | ||
{ | ||
return ioExceptions; | ||
} | ||
|
||
@Managed | ||
@Nested | ||
public CounterStat getFileNotFoundExceptions() | ||
{ | ||
return fileNotFoundExceptions; | ||
} | ||
|
||
@Managed | ||
@Nested | ||
public TimeStat getTime() | ||
{ | ||
return time; | ||
} | ||
|
||
public void newCall() | ||
{ | ||
totalCalls.update(1); | ||
} | ||
} |
37 changes: 37 additions & 0 deletions
37
lib/trino-hdfs/src/main/java/io/trino/hdfs/HdfsNamenodeStats.java
This file contains 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,37 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package io.trino.hdfs; | ||
|
||
import org.weakref.jmx.Managed; | ||
import org.weakref.jmx.Nested; | ||
|
||
public final class HdfsNamenodeStats | ||
{ | ||
private final CallStats listLocatedStatus = new CallStats(); | ||
private final CallStats remoteIteratorNext = new CallStats(); | ||
|
||
@Managed | ||
@Nested | ||
public CallStats getListLocatedStatus() | ||
{ | ||
return listLocatedStatus; | ||
} | ||
|
||
@Managed | ||
@Nested | ||
public CallStats getRemoteIteratorNext() | ||
{ | ||
return remoteIteratorNext; | ||
} | ||
} |
83 changes: 0 additions & 83 deletions
83
lib/trino-hdfs/src/main/java/io/trino/hdfs/NamenodeStats.java
This file was deleted.
Oops, something went wrong.
This file contains 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 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
Oops, something went wrong.