This is an automated email from the ASF dual-hosted git repository. chenjunxu pushed a commit to branch doc-generated-format in repository https://gitbox.apache.org/repos/asf/skywalking-satellite.git
commit 52d9dabcb2435892e7162ef63bb6a186e44fdd1f Author: nic-chen <[email protected]> AuthorDate: Thu Jan 14 14:04:36 2021 +0800 chore: optimize the format of the generated document --- docs/plugin-description.md | 20 ++++++++++---------- internal/satellite/tools/generate_plugin_doc.go | 23 ++++++++++++----------- 2 files changed, 22 insertions(+), 21 deletions(-) diff --git a/docs/plugin-description.md b/docs/plugin-description.md index b5c977b..ca87cf5 100755 --- a/docs/plugin-description.md +++ b/docs/plugin-description.md @@ -1,9 +1,9 @@ # api.Client ## kafka-client ### description -```this is a sharing client to delivery the data to Kafka.``` +this is a sharing client to delivery the data to Kafka. ### defaultConfig -``` +```yaml # The Kafka broker addresses (default localhost:9092). Multiple values are separated by commas. brokers: localhost:9092 @@ -55,27 +55,27 @@ insecure_skip_verify: true # api.Fallbacker ## timer-fallbacker ### description -```this is a timer fallback trigger when forward fails.``` +this is a timer fallback trigger when forward fails. ### defaultConfig -``` +```yaml max_times: 3 latency_factor: 2000 ``` # api.Forwarder ## log-kafka-forwarder ### description -```this is a synchronization Kafka log forwarder.``` +this is a synchronization Kafka log forwarder. ### defaultConfig -``` +```yaml # The remote topic. topic: "log-topic" ``` # api.Queue ## mmap-queue ### description -```this is a memory mapped queue to provide the persistent storage.``` +this is a memory mapped queue to provide the persistent storage. ### defaultConfig -``` +```yaml # The size of each segment. Default value is 128K. The unit is Byte. segment_size: 131072 # The max num of segments in memory. Default value is 10. @@ -94,9 +94,9 @@ max_event_size: 20480 # api.Server ## prometheus-server ### description -```this is a prometheus server to export the metrics in Satellite.``` +this is a prometheus server to export the metrics in Satellite. ### defaultConfig -``` +```yaml # The prometheus server address. address: ":9299" # The prometheus server metrics endpoint. diff --git a/internal/satellite/tools/generate_plugin_doc.go b/internal/satellite/tools/generate_plugin_doc.go index 14ca5ad..3dd3fda 100644 --- a/internal/satellite/tools/generate_plugin_doc.go +++ b/internal/satellite/tools/generate_plugin_doc.go @@ -31,15 +31,16 @@ import ( ) const ( - docDir = "docs" - docPath = docDir + "/plugin-description.md" - topLevel = "# " - SecondLevel = "## " - thirdLevel = "### " - LF = "\n" - codeQuote = "```" - descStr = "description" - confStr = "defaultConfig" + docDir = "docs" + docPath = docDir + "/plugin-description.md" + topLevel = "# " + SecondLevel = "## " + thirdLevel = "### " + LF = "\n" + yamlQuoteStart = "```yaml" + yamlQuoteEnd = "```" + descStr = "description" + confStr = "defaultConfig" ) func GeneratePluginDoc() error { @@ -66,8 +67,8 @@ func GeneratePluginDoc() error { p := plugin.Get(category, plugin.Config{plugin.NameField: key}) doc += topLevel + category.String() + LF doc += SecondLevel + key + LF - doc += thirdLevel + descStr + LF + codeQuote + p.Description() + codeQuote + LF - doc += thirdLevel + confStr + LF + codeQuote + p.DefaultConfig() + codeQuote + LF + doc += thirdLevel + descStr + LF + p.Description() + LF + doc += thirdLevel + confStr + LF + yamlQuoteStart + p.DefaultConfig() + yamlQuoteEnd + LF } } if err := createDir(docDir); err != nil {
