BedrockStreaming / StatsdBundle

Symfony bundle proving a statsd service and smooth integration in sf2

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

cannot add multiple increments or timing

omansour opened this issue · comments

YAML format doesnt allow it anymore ?

                edge.redirectedto:
                    increment: 'service.service-6play-lbcdn.byedge.<getEdgeHostname>.<getCountryCode>.<getAsn>.edge-redirectedto'
                    increment: 'service.service-6play-lbcdn.bycountry.<getCountryCode>.edge-redirectedto'
                    increment: 'service.service-6play-lbcdn.byasn.<getAsn>.edge-redirectedto'

give

symfony_profiler

Indeed, this is not valid YAML and Symfony tends to be more and more "valid YAML compliant" (+ some useful features like using PHP constants, etc.)

From the YAML spec:

The content of a mapping node is an unordered set of key: value node pairs, with the restriction that each of the keys is unique

I propose to also accept an array of YAML objects (in addition to a single YAML object, to avoid breaking everything), like the following:

# new syntax accepting an array of objects (to avoid duplicate keys)
edge.redirectedto:
    - increment: 'service.service-6play-lbcdn.byedge.<getEdgeHostname>.<getCountryCode>.<getAsn>.edge-redirectedto'
    - increment: 'service.service-6play-lbcdn.bycountry.<getCountryCode>.edge-redirectedto'
    - increment: 'service.service-6play-lbcdn.byasn.<getAsn>.edge-redirectedto'

# still possible to use a single object
my_event:
    increment: 'a.metric'
    decrement: 'another.metric'

# new array syntax containing a single object with multiple keys
my_event_2:
    - 
        increment: 'a.metric'
        decrement: 'another.metric'

# which would be exactly the same as using 2 objects each one containing a single key
my_event_3:
    - increment: 'a.metric'
    - decrement: 'another.metric'

what do you think?