Skip to content

Commit

Permalink
rename package
Browse files Browse the repository at this point in the history
  • Loading branch information
jianhao.dai committed Aug 16, 2018
1 parent da4177d commit a2f068c
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
18 changes: 9 additions & 9 deletions README.md
@@ -1,14 +1,14 @@
Name
=============

lua-resty-metrics - lua metrics module for OpenResty/LuaJIT with influxdb
lua-resty-influx - lua influx metrics module for OpenResty/LuaJIT

Status
======

This library is considered production ready.

Build status: [![Travis](https://travis-ci.org/toruneko/lua-resty-metrics.svg?branch=master)](https://travis-ci.org/toruneko/lua-resty-metrics)
Build status: [![Travis](https://travis-ci.org/toruneko/lua-resty-influx.svg?branch=master)](https://travis-ci.org/toruneko/lua-resty-influx)

Description
===========
Expand All @@ -21,18 +21,18 @@ Synopsis
```lua
# nginx.conf:

lua_package_path "/path/to/lua-resty-metrics/lib/?.lua;;";
lua_package_path "/path/to/lua-resty-influx/lib/?.lua;;";
lua_shared_dict metrics 1m;

init_worker_by_lua_block {
local resty_reporter = require "resty.influxdb.reporter"
local resty_reporter = require "resty.influx.db.reporter"
local reporter = resty_reporter.new("http://127.0.0.1:12354", "user", "pass", "nginx", {
tags = {
host = "127.0.0.1"
},
async = true
})
local resty_registry = require "resty.registry"
local resty_registry = require "resty.influx.registry"
_G.registry = resty_registry.new("metrics", {reporter})

local reporter
Expand Down Expand Up @@ -81,11 +81,11 @@ Methods

To load this library,

1. you need to specify this library's path in ngx_lua's [lua_package_path](https://github.com/openresty/lua-nginx-module#lua_package_path) directive. For example, `lua_package_path "/path/to/lua-resty-metrics/lib/?.lua;;";`.
1. you need to specify this library's path in ngx_lua's [lua_package_path](https://github.com/openresty/lua-nginx-module#lua_package_path) directive. For example, `lua_package_path "/path/to/lua-resty-influx/lib/?.lua;;";`.
2. you use `require` to load the library into a local Lua variable:

```lua
local resty_registry = require "resty.registry"
local resty_registry = require "resty.influx.registry"
```

new
Expand All @@ -96,14 +96,14 @@ Creates a new registry object instance.

```lua
-- creates a registry object
local resty_registry = require "resty.registry"
local resty_registry = require "resty.influx.registry"
local registry = resty_registry.new("metrics")
```

Report metrics to the influxdb.

```lua
local resty_reporter = require "resty.influxdb.reporter"
local resty_reporter = require "resty.influx.db.reporter"
local reporter = resty_reporter.new("http://127.0.0.1:12354", "user", "pass", "nginx")
local registry = resty_registry.new("metrics", { reporter })
```
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
-- Copyright (C) by Jianhao Dai (Toruneko)
local point = require "resty.influxdb.point"
local client = require "resty.influxdb.client"
local point = require "resty.influx.db.point"
local client = require "resty.influx.db.client"

local setmetatable = setmetatable
local timer_at = ngx.timer.at
Expand Down
@@ -1,8 +1,8 @@
-- Copyright (C) by Jianhao Dai (Toruneko)

local timer = require "resty.metrics.timer"
local counter = require "resty.metrics.counter"
local averager = require "resty.metrics.averager"
local timer = require "resty.influx.metrics.timer"
local counter = require "resty.influx.metrics.counter"
local averager = require "resty.influx.metrics.averager"

local pairs = pairs
local setmetatable = setmetatable
Expand Down
File renamed without changes.
File renamed without changes.
@@ -1,6 +1,6 @@
-- Copyright (C) by Jianhao Dai (Toruneko)
local averager = require "resty.metrics.averager"
local context = require "resty.metrics.timer.context"
local averager = require "resty.influx.metrics.averager"
local context = require "resty.influx.metrics.timer.context"
local setmetatable = setmetatable

local _M = { _VERSION = '0.01' }
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion lib/resty/registry.lua → lib/resty/influx/registry.lua
@@ -1,6 +1,6 @@
-- Copyright (C) by Jianhao Dai (Toruneko)

local measurement = require "resty.measurement"
local measurement = require "resty.influx.measurement"

local setmetatable = setmetatable
local shared = ngx.shared
Expand Down
4 changes: 2 additions & 2 deletions t/metrics.t
Expand Up @@ -18,14 +18,14 @@ our $HttpConfig = <<_EOC_;
lua_package_path "$pwd/lib/?.lua;$pwd/t/lib/?.lua;;";
lua_shared_dict metrics 1m;
init_worker_by_lua_block {
local resty_reporter = require "resty.influxdb.reporter"
local resty_reporter = require "resty.influx.db.reporter"
local reporter = resty_reporter.new("http://127.0.0.1:12354", "user", "pass", "nginx", {
tags = {
host = "127.0.0.1"
},
async = true
})
local resty_registry = require "resty.registry"
local resty_registry = require "resty.influx.registry"
_G.registry = resty_registry.new("metrics", {reporter})
}
_EOC_
Expand Down

0 comments on commit a2f068c

Please sign in to comment.