bennadel / StatsDGateway.cfc

This is a ColdFusion gateway to help send metrics to a statsD server (including extensions for DataDogHQ and DogStatsD).
Other
5 stars 2 forks source link

Client scope not enabled error? #1

Open yamikuronue opened 6 years ago

yamikuronue commented 6 years ago

Trying to use this library under Lucee, I'm getting the following:

4/23/2018 2:50:01 PMlucee.runtime.exp.ExpressionException: client scope is not enabled
4/23/2018 2:50:01 PM    at lucee.runtime.PageContextImpl.clientScope(PageContextImpl.java:1391)
4/23/2018 2:50:01 PM    at statsd.statsdgateway_cfc$cf.udfCall(/statsd/StatsDGateway.cfc:64)
4/23/2018 2:50:01 PM    at lucee.runtime.type.UDFImpl.implementation(UDFImpl.java:108)
4/23/2018 2:50:01 PM    at lucee.runtime.type.UDFImpl._call(UDFImpl.java:367)
4/23/2018 2:50:01 PM    at lucee.runtime.type.UDFImpl.call(UDFImpl.java:227)
4/23/2018 2:50:01 PM    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:697)
4/23/2018 2:50:01 PM    at lucee.runtime.ComponentImpl._call(ComponentImpl.java:580)
4/23/2018 2:50:01 PM    at lucee.runtime.ComponentImpl.call(ComponentImpl.java:1918)
4/23/2018 2:50:01 PM    at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:758)
4/23/2018 2:50:01 PM    at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:1698)

I think this is due to your use of the reserved word client (as in the scope). Please advise?

yamikuronue commented 6 years ago

Yeah, the following code change to StatsDGateway.cfc fixes it. I might put together a PR later; I don't have time to check it on various versions of Adobe CF but it should be fine. Change lines 62 and 64 to:

        var c = new sdclient.StatsDClient( transport, sampler, prefix, suffix );

        return( c );

and rename the folder client to sdclient. ditto for 106-114:

        var c = new sdclient.DogStatsDClient(
            transport = transport,
            sampler = sampler,
            prefix = prefix,
            suffix = suffix,
            tags = tags
        );

        return( c );
yamikuronue commented 6 years ago

See #2