[ 
https://issues.apache.org/jira/browse/TS-3346?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14311060#comment-14311060
 ] 

Leif Hedstrom edited comment on TS-3346 at 2/8/15 2:02 AM:
-----------------------------------------------------------

I don't know much about lua, but it seems like it ought to be able to figure 
that out. So, couldn't ts.stat_create() create int, float and string types, and 
when you do ts.stat_increment(), it knows what type this is?

Also, now that I think about this, the format seems odd to me. Is the intent 
that you'd lookup the metric by string every time? Why not e.g.

{code}
stat = ts.stat_create("name of metric", type, persistence, sync)
{code}

and then

{code}
stat.increment()
{code}

or even

{code}
stat = stat + 12
{code}

etc. ? You would also need a lookup mechanism, e.g.

{code}
my_stat = ts.stat_find("name")
{code}

I understand the plugin is not frozen, and we develop as we learn. But it feels 
we ought to take better advantage of Lua's high level language features, no ?


was (Author: zwoop):
I don't know much about lua, but it seems like it ought to be able to figure 
that out. So, couldn't ts.stat_create() create int, float and string types, and 
when you do ts.stat_increment(), it knows what type this is?

Also, now that I think about this, the format seems odd to me. Is the intent 
that you'd lookup the metric by string every time? Why not e.g.

{code}
stat = ts.stat_create("name of metric", type, persistence, sync)
{code}

and then

{code}
stat.increment()
{code}

or even

{code}
stat = stat + 12
{code}

etc. ? You would also need a lookup mechanism, e.g.

my_stat = ts.stat_find("name")

I understand the plugin is not frozen, and we develop as we learn. But it feels 
we ought to take better advantage of Lua's high level language features, no ?

> Support TS Stat API in Lua
> --------------------------
>
>                 Key: TS-3346
>                 URL: https://issues.apache.org/jira/browse/TS-3346
>             Project: Traffic Server
>          Issue Type: Improvement
>          Components: Lua
>            Reporter: Wei Sun
>            Assignee: Kit Chan
>             Fix For: 5.3.0
>
>
> Lua script supports to read/collect error rate, timeout rate, avg latency by 
> origin host.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to