-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into 562-evict-metrics-from-redis-after-120-days
- Loading branch information
Showing
33 changed files
with
455 additions
and
76 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
1.16.6 | ||
1.16.8 |
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
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
58 changes: 58 additions & 0 deletions
58
src/main/groovy/io/seqera/wave/configuration/ProxyCacheConfig.groovy
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,58 @@ | ||
/* | ||
* Wave, containers provisioning service | ||
* Copyright (c) 2023-2024, Seqera Labs | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.seqera.wave.configuration | ||
|
||
import java.time.Duration | ||
|
||
import groovy.transform.CompileStatic | ||
import groovy.transform.ToString | ||
import io.micronaut.context.annotation.Value | ||
import jakarta.inject.Singleton | ||
|
||
/** | ||
* Model {@link io.seqera.wave.proxy.ProxyCache} configuration settings | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
@Singleton | ||
@CompileStatic | ||
@ToString(includeNames = true, includePackage = false) | ||
class ProxyCacheConfig { | ||
|
||
@Value('${wave.proxy-cache.duration:4m}') | ||
private Duration duration | ||
|
||
@Value('${wave.proxy-cache.max-size:10000}') | ||
private int maxSize | ||
|
||
@Value('${wave.proxy-cache.enabled:true}') | ||
private boolean enabled | ||
|
||
Duration getDuration() { | ||
return duration | ||
} | ||
|
||
int getMaxSize() { | ||
return maxSize | ||
} | ||
|
||
boolean getEnabled() { | ||
return enabled | ||
} | ||
} |
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
63 changes: 63 additions & 0 deletions
63
src/main/groovy/io/seqera/wave/filter/TraceContextFilter.groovy
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,63 @@ | ||
/* | ||
* Wave, containers provisioning service | ||
* Copyright (c) 2023-2024, Seqera Labs | ||
* | ||
* This program is free software: you can redistribute it and/or modify | ||
* it under the terms of the GNU Affero General Public License as published by | ||
* the Free Software Foundation, either version 3 of the License, or | ||
* (at your option) any later version. | ||
* | ||
* This program is distributed in the hope that it will be useful, | ||
* but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
* GNU Affero General Public License for more details. | ||
* | ||
* You should have received a copy of the GNU Affero General Public License | ||
* along with this program. If not, see <https://www.gnu.org/licenses/>. | ||
*/ | ||
|
||
package io.seqera.wave.filter | ||
|
||
import java.util.regex.Pattern | ||
|
||
import groovy.transform.CompileStatic | ||
import io.micronaut.context.propagation.slf4j.MdcPropagationContext | ||
import io.micronaut.core.propagation.MutablePropagatedContext | ||
import io.micronaut.http.HttpRequest | ||
import io.micronaut.http.annotation.RequestFilter | ||
import io.micronaut.http.annotation.ServerFilter | ||
import org.slf4j.MDC | ||
import static io.micronaut.http.annotation.ServerFilter.MATCH_ALL_PATTERN | ||
|
||
/** | ||
* HTTP filter to trace and propagate request metadata in the MDC logging context | ||
* | ||
* @author Paolo Di Tommaso <[email protected]> | ||
*/ | ||
@CompileStatic | ||
@ServerFilter(MATCH_ALL_PATTERN) | ||
class TraceContextFilter { | ||
|
||
static final Pattern REGEX = ~/^\/v2\/wt\/([a-z0-9]+).*/ | ||
|
||
@RequestFilter | ||
void requestFilter(HttpRequest<?> request, MutablePropagatedContext mutablePropagatedContext) { | ||
try { | ||
final requestId = getRequestId(request.path) | ||
MDC.put("requestId", requestId) | ||
MDC.put("requestPath", request.path) | ||
MDC.put("requestMethod", request.methodName) | ||
mutablePropagatedContext.add(new MdcPropagationContext()) | ||
} finally { | ||
MDC.remove("requestId") | ||
MDC.remove("requestPath") | ||
MDC.remove("requestMethod") | ||
} | ||
} | ||
|
||
static String getRequestId(String path) { | ||
final m = REGEX.matcher(path) | ||
return m.matches() ? m.group(1) : null | ||
} | ||
|
||
} |
Oops, something went wrong.