-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Flink-K8s-V2] Port the new module codes to Streampark-flink-kubernet…
…es-v2 (#2916) * Initialize flink kubernetes v2 modules. #2881 Supplement additional license statement. #2881 Initialize flink kubernetes v2 modules. #2881 * Delete configuration A to obtain a more compact lambda format. * Migrate util codes #2881 * Migrate zio extension to srteampark-common #2881 * mark Deprecated flink-k8s config #2881 * flink-k8s v2 configuration #2881 * Embedded http file server implementation. #2881 * update scalafmt * remove util package. #2881 * Init flink-k8s-v2 model and rest request wrapper. #2881 * format code. #2881 * Conversion of Flink K8s JobSnapshot to FlinkAppState. #2881 * replace deprecated anno. #2881 * Implementation of flink k8s resources operators and observers. #2881 * Reimplement ZIO StreamPark logger backend. #2881 * Fix the incorrect mirror path . #2881 * template store . #2881 * Refactor: Remove flink-kubenretes-api shaded module and generate code directly from CRD yaml file. #2881 * Replace sttp client to zio-http client due to Java 8 incompatibility #2881 * Move the evaluation process of the final status of flink k8s tasks to the flink-k8s-v2 module for better readability. #2881 * Format code * Solve compilation issues. #2881
- Loading branch information
Showing
64 changed files
with
14,077 additions
and
88 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one or more | ||
# contributor license agreements. See the NOTICE file distributed with | ||
# this work for additional information regarding copyright ownership. | ||
# The ASF licenses this file to You 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 | ||
# | ||
# https://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. | ||
# | ||
|
||
runner.dialect = scala212 | ||
|
||
# Version is required to make sure IntelliJ picks the right version | ||
version = 3.4.3 | ||
preset = default | ||
|
||
# Max column | ||
maxColumn = 120 | ||
|
||
# This parameter simply says the .stripMargin method was not redefined by the user to assign | ||
# special meaning to indentation preceding the | character. Hence, that indentation can be modified. | ||
assumeStandardLibraryStripMargin = true | ||
align.stripMargin = true | ||
|
||
# Align settings | ||
align.preset = most | ||
align.closeParenSite = false | ||
align.openParenCallSite = false | ||
danglingParentheses.defnSite = false | ||
danglingParentheses.callSite = false | ||
danglingParentheses.ctrlSite = true | ||
danglingParentheses.tupleSite = false | ||
align.openParenCallSite = false | ||
align.openParenDefnSite = false | ||
align.openParenTupleSite = false | ||
|
||
# Newlines | ||
newlines.alwaysBeforeElseAfterCurlyIf = false | ||
newlines.afterCurlyLambdaParams = squash # No newline after lambda params | ||
newlines.inInterpolation = "avoid" | ||
newlines.avoidInResultType = true | ||
optIn.annotationNewlines = true | ||
|
||
# Scaladoc | ||
docstrings.style = Asterisk # Javadoc style | ||
docstrings.removeEmpty = true | ||
docstrings.oneline = fold | ||
docstrings.forceBlankLineBefore = true | ||
docstrings.wrap = no | ||
|
||
# Indentation | ||
indent.extendSite = 2 # This makes sure extend is not indented as the ctor parameters | ||
indentOperator.preset = spray | ||
|
||
# Rewrites | ||
rewrite.rules = [AvoidInfix, Imports, RedundantBraces, SortModifiers] | ||
|
||
# Imports | ||
rewrite.imports.sort = scalastyle | ||
rewrite.imports.groups = [ | ||
["org.apache.streampark\\..*"], | ||
["org.apache.streampark.shaded\\..*"], | ||
[".*"], | ||
["javax\\..*"], | ||
["java\\..*"], | ||
["scala\\..*"] | ||
] | ||
rewrite.imports.contiguousGroups = no | ||
importSelectors = singleline # Imports in a single line, like IntelliJ | ||
|
||
# Remove redundant braces in string interpolation. | ||
rewrite.redundantBraces.stringInterpolation = true | ||
rewrite.redundantBraces.defnBodies = false | ||
rewrite.redundantBraces.generalExpressions = false | ||
rewrite.redundantBraces.ifElseExpressions = false | ||
rewrite.redundantBraces.methodBodies = false | ||
rewrite.redundantBraces.includeUnitMethods = false | ||
rewrite.redundantBraces.maxBreaks = 1 | ||
|
||
# Remove trailing commas | ||
rewrite.trailingCommas.style = "never" |
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
79 changes: 79 additions & 0 deletions
79
streampark-common/src/main/scala/org/apache/streampark/common/zio/LoggerBackend.scala
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,79 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one or more | ||
* contributor license agreements. See the NOTICE file distributed with | ||
* this work for additional information regarding copyright ownership. | ||
* The ASF licenses this file to You 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 org.apache.streampark.common.zio | ||
|
||
import org.apache.streampark.common.util.Logger | ||
|
||
import zio.{Cause, FiberId, FiberRefs, LogLevel, LogSpan, Runtime, Trace, ZLayer, ZLogger} | ||
import zio.logging.LoggerNameExtractor | ||
|
||
import scala.collection.concurrent.TrieMap | ||
|
||
/** ZIO logging Backend that bridging to [[org.apache.streampark.common.util.Logger]] */ | ||
object LoggerBackend { | ||
|
||
lazy val default: ZLayer[Any, Nothing, Unit] = Runtime.addLogger(provideLogger()) | ||
|
||
private val defaultLoggerName = getClass.getName | ||
private val loggers = TrieMap[String, BridgeLogger]() | ||
|
||
private def getLogger(loggerName: String): BridgeLogger = { | ||
loggers.getOrElseUpdate(loggerName, BridgeLogger(loggerName)) | ||
} | ||
|
||
private case class BridgeLogger(loggerName: String) extends Logger { | ||
override protected def logName: String = loggerName | ||
|
||
def trace(msg: String): Unit = super.logTrace(msg) | ||
def info(msg: String): Unit = super.logInfo(msg) | ||
def warn(msg: String): Unit = super.logWarn(msg) | ||
def error(msg: String): Unit = super.logError(msg) | ||
def debug(msg: String): Unit = super.logDebug(msg) | ||
} | ||
|
||
private def provideLogger(): ZLogger[String, Unit] = ( | ||
trace: Trace, | ||
fiberId: FiberId, | ||
logLevel: LogLevel, | ||
message: () => String, | ||
cause: Cause[Any], | ||
context: FiberRefs, | ||
spans: List[LogSpan], | ||
annotations: Map[String, String]) => { | ||
|
||
val loggerName = | ||
LoggerNameExtractor.trace(trace, FiberRefs.empty, Map.empty).getOrElse(defaultLoggerName) | ||
val logger = getLogger(loggerName) | ||
val msg = | ||
if (annotations.nonEmpty) | ||
s"${annotations.map { case (k, v) => s"[$k=$v]" }.mkString(" ")} ${message()}" | ||
else message() | ||
|
||
logLevel match { | ||
case LogLevel.None => logger.trace(msg) | ||
case LogLevel.All => logger.trace(msg) | ||
case LogLevel.Trace => logger.trace(msg) | ||
case LogLevel.Debug => logger.debug(msg) | ||
case LogLevel.Info => logger.info(msg) | ||
case LogLevel.Warning => logger.warn(msg) | ||
case LogLevel.Error => logger.error(msg) | ||
case LogLevel.Fatal => logger.error(msg) | ||
} | ||
} | ||
|
||
} |
Oops, something went wrong.