You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@apisix.apache.org by GitBox <gi...@apache.org> on 2021/07/20 11:38:21 UTC

[GitHub] [apisix] tokers commented on a change in pull request #4633: feat: add error log skywalking reporter

tokers commented on a change in pull request #4633:
URL: https://github.com/apache/apisix/pull/4633#discussion_r673043567



##########
File path: apisix/plugins/error-log-skywalking-logger.lua
##########
@@ -0,0 +1,260 @@
+--
+-- 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.
+--
+
+local core = require("apisix.core")
+local errlog = require("ngx.errlog")
+local batch_processor = require("apisix.utils.batch-processor")
+local plugin = require("apisix.plugin")
+local timers = require("apisix.timers")
+local http = require("resty.http")
+local url = require("net.url")
+local plugin_name = "error-log-skywalking-logger"
+local table = core.table
+local schema_def = core.schema
+local ngx = ngx
+local string = string
+local tostring = tostring
+local ipairs  = ipairs
+local lrucache = core.lrucache.new({
+    ttl = 300, count = 32
+})
+
+
+local metadata_schema = {
+    type = "object",
+    properties = {
+        endpoint = schema_def.uri,
+        service_name = {type = "string", default = "APISIX"},
+        service_instance_name = {type="string", default = "APISIX Service Instance"},
+        timeout = {type = "integer", minimum = 1, default = 3},
+        keepalive = {type = "integer", minimum = 1, default = 30},
+        level = {type = "string", default = "WARN", enum = {"STDERR", "EMERG", "ALERT", "CRIT",
+                "ERR", "ERROR", "WARN", "NOTICE", "INFO", "DEBUG"}},
+        batch_max_size = {type = "integer", minimum = 0, default = 1000},
+        max_retry_count = {type = "integer", minimum = 0, default = 0},
+        retry_delay = {type = "integer", minimum = 0, default = 1},
+        buffer_duration = {type = "integer", minimum = 1, default = 60},
+        inactive_timeout = {type = "integer", minimum = 1, default = 3},
+    },
+    required = {"endpoint"}
+}
+
+
+local schema = {
+    type = "object",
+}
+
+
+local log_level = {

Review comment:
       Agree, and this extension might be reused by many other plugins in the future.




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: notifications-unsubscribe@apisix.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org