-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #189 from iExecBlockchainComputing/release/8.2.0
Release/8.2.0
- Loading branch information
Showing
23 changed files
with
907 additions
and
52 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
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 |
---|---|---|
@@ -1,4 +1,4 @@ | ||
version=8.1.2 | ||
version=8.2.0 | ||
iexecCommonVersion=8.2.1 | ||
iexecCommonsPocoVersion=3.0.5 | ||
|
||
|
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
36 changes: 36 additions & 0 deletions
36
iexec-sms-library/src/main/java/com/iexec/sms/metric/SmsMetrics.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,36 @@ | ||
/* | ||
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH | ||
* | ||
* 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 com.iexec.sms.metric; | ||
|
||
import lombok.AllArgsConstructor; | ||
import lombok.Builder; | ||
import lombok.Getter; | ||
import lombok.NoArgsConstructor; | ||
|
||
import java.util.Map; | ||
|
||
@Builder | ||
@NoArgsConstructor | ||
@AllArgsConstructor | ||
@Getter | ||
public class SmsMetrics { | ||
/** | ||
* A map of secrets metrics, whose key is the type of secrets it holds | ||
* and value is the metrics themselves. | ||
*/ | ||
private Map<String, SecretsMetrics> secretsMetrics; | ||
} |
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,105 @@ | ||
/* | ||
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH | ||
* | ||
* 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 com.iexec.sms.config; | ||
|
||
import com.iexec.sms.metric.MetricsService; | ||
import com.iexec.sms.secret.MeasuredSecretService; | ||
import com.iexec.sms.secret.compute.TeeTaskComputeSecretRepository; | ||
import com.iexec.sms.secret.web2.Web2SecretRepository; | ||
import com.iexec.sms.secret.web3.Web3SecretRepository; | ||
import org.springframework.beans.factory.annotation.Autowired; | ||
import org.springframework.beans.factory.annotation.Value; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
import javax.annotation.PreDestroy; | ||
import java.util.concurrent.Executors; | ||
import java.util.concurrent.ScheduledExecutorService; | ||
import java.util.concurrent.TimeUnit; | ||
|
||
@Configuration | ||
public class SecretsConfig { | ||
private final MetricsService metricsService; | ||
private final ScheduledExecutorService storageMetricsExecutorService; | ||
|
||
@Autowired | ||
public SecretsConfig(MetricsService metricsService) { | ||
this.metricsService = metricsService; | ||
this.storageMetricsExecutorService = Executors.newSingleThreadScheduledExecutor(); | ||
} | ||
|
||
SecretsConfig(MetricsService metricsService, | ||
ScheduledExecutorService storageMetricsExecutorService) { | ||
this.metricsService = metricsService; | ||
this.storageMetricsExecutorService = storageMetricsExecutorService; | ||
} | ||
|
||
@PreDestroy | ||
void shutdown() throws InterruptedException { | ||
storageMetricsExecutorService.shutdown(); | ||
try { | ||
if (!storageMetricsExecutorService.awaitTermination(800, TimeUnit.MILLISECONDS)) { | ||
storageMetricsExecutorService.shutdownNow(); | ||
} | ||
} catch (InterruptedException e) { | ||
storageMetricsExecutorService.shutdownNow(); | ||
throw e; | ||
} | ||
} | ||
|
||
@Bean | ||
MeasuredSecretService web2MeasuredSecretService(Web2SecretRepository web2SecretRepository, | ||
@Value("${metrics.storage.refresh-interval}") int storedSecretsCountPeriod) { | ||
return metricsService.registerNewMeasuredSecretService( | ||
new MeasuredSecretService( | ||
"web2", | ||
"iexec.sms.secrets.web2.", | ||
web2SecretRepository::count, | ||
storageMetricsExecutorService, | ||
storedSecretsCountPeriod | ||
) | ||
); | ||
} | ||
|
||
@Bean | ||
MeasuredSecretService web3MeasuredSecretService(Web3SecretRepository web3SecretRepository, | ||
@Value("${metrics.storage.refresh-interval}") int storedSecretsCountPeriod) { | ||
return metricsService.registerNewMeasuredSecretService( | ||
new MeasuredSecretService( | ||
"web3", | ||
"iexec.sms.secrets.web3.", | ||
web3SecretRepository::count, | ||
storageMetricsExecutorService, | ||
storedSecretsCountPeriod | ||
) | ||
); | ||
} | ||
|
||
@Bean | ||
MeasuredSecretService computeMeasuredSecretService(TeeTaskComputeSecretRepository teeTaskComputeSecretRepository, | ||
@Value("${metrics.storage.refresh-interval}") int storedSecretsCountPeriod) { | ||
return metricsService.registerNewMeasuredSecretService( | ||
new MeasuredSecretService( | ||
"compute", | ||
"iexec.sms.secrets.compute.", | ||
teeTaskComputeSecretRepository::count, | ||
storageMetricsExecutorService, | ||
storedSecretsCountPeriod | ||
) | ||
); | ||
} | ||
} |
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,40 @@ | ||
/* | ||
* Copyright 2023-2023 IEXEC BLOCKCHAIN TECH | ||
* | ||
* 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 com.iexec.sms.metric; | ||
|
||
import org.springframework.http.ResponseEntity; | ||
import org.springframework.web.bind.annotation.GetMapping; | ||
import org.springframework.web.bind.annotation.RequestMapping; | ||
import org.springframework.web.bind.annotation.RestController; | ||
|
||
import static org.springframework.http.ResponseEntity.ok; | ||
|
||
@RestController | ||
@RequestMapping("/metrics") | ||
public class MetricsController { | ||
|
||
private final MetricsService metricsService; | ||
|
||
public MetricsController(MetricsService metricsService) { | ||
this.metricsService = metricsService; | ||
} | ||
|
||
@GetMapping | ||
public ResponseEntity<SmsMetrics> getSmsMetrics() { | ||
return ok(metricsService.getSmsMetrics()); | ||
} | ||
} |
Oops, something went wrong.