Merge "Fix lua issues in elasticsearch hidnsight part"
This commit is contained in:
commit
a874aef9dd
|
@ -11,8 +11,12 @@
|
|||
-- 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.
|
||||
require "string"
|
||||
require "cjson"
|
||||
local string = require "string"
|
||||
local cjson = require "cjson"
|
||||
local utils = require "lma_utils"
|
||||
local table = require "table"
|
||||
local pairs = pairs
|
||||
local read_message = read_message
|
||||
local utils = require "lma_utils"
|
||||
|
||||
local index = read_config("index") or "index"
|
||||
|
|
|
@ -68,6 +68,8 @@ local resource_msg = {
|
|||
}
|
||||
|
||||
function add_resource_to_payload(sample, payload)
|
||||
local counter_name, _ = string.gsub(sample.counter_name, "%.", "\\")
|
||||
|
||||
local resource_data = {
|
||||
timestamp = sample.timestamp,
|
||||
resource_id = sample.resource_id,
|
||||
|
@ -76,7 +78,7 @@ function add_resource_to_payload(sample, payload)
|
|||
user_id = sample.user_id,
|
||||
project_id = sample.project_id,
|
||||
meter = {
|
||||
[sample.counter_name] = {
|
||||
[counter_name] = {
|
||||
type = sample.counter_type,
|
||||
unit = sample.counter_unit
|
||||
}
|
||||
|
|
|
@ -182,4 +182,4 @@ function timer_event(ns, shutdown)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue