GitHub user acaciocenteno opened a pull request:

    https://github.com/apache/trafficserver/pull/106

    Added Unique Identifier to HttpSM, to aid on debugging

    While debugging the plugins we've written, we sometimes had trouble
    correlating the log messages to one specific request. That is, suppose
    thread 1 was executing plugin A, while thread 2 was also executing
    plugin A, but for another request. Then the messages on traffic.out
    would be intermingled and separating them was sometimes hard. The same
    issue would happen if we wanted to correlate messages from the Core
    with messages from the plugin, or when trying to correlate plugin A
    messages with plugin B messages for the same request.
    
    The solution we came up with was to patch the HttpSM to generate a
    Unique Identifier, and expose it to the plugins. Then we created a
    script to grep the traffic.out log for this UUID, resulting in
    something like this:
    
    1. Issue request:
    $ curl -i --proxy 127.0.0.1:8080 'http://a.com/'
    HTTP/1.1 200 OK
    ...
    X-Azion-UUID: a7555903-0939-41ab-bc29-2c02ee80e19a
    ...
    
    2. Get logs using a script to grep traffic.out:
    $ getlog.sh a7555903-0939-41ab-bc29-2c02ee80e19a
    ======== [Sep 1 21:05:07.394] ========
    Client IP: [127.0.0.1].
    Current Tier: [Slaves]
    Chosen origin server: [127.0.0.1:1025].
    Orignal scheme [http]
    Orignal host [a.com]
    Host set to [www.example.com]. Scheme set to [http]
    Sending Request.
    Got Response [404]. Falling back.
    Current Tier: [Master]
    Chosen origin server: [127.0.0.1:1026].
    Host set to [a.com]. Scheme set to [http]
    Sending Request.
    Got Response [200]. Delivering to client.
    ======== [Sep 1 21:05:07.398] ========
    
    
    This ID has proved very useful while debugging several issues, not to
    mention that it helped us to understand how the Core was handling the
    requests, so we thought it could be useful for others, and decided to
    create this pull request.
    
    As we understand that not everyone would like to use it, we've added a
    configure flag, namely, --enable-uuid, to turn the feature on/off at
    compile time. Also, as we understand that this feature is useful for
    debugging only, we've added options to records.config that allow it to
    be turned off:
    
    CONFIG proxy.config.http.use_uuid INT 1
    CONFIG proxy.config.http.add_uuid_to_response INT 1
    CONFIG proxy.config.http.add_uuid_to_request INT 1
    CONFIG proxy.config.http.uuid_header_name STRING X-Azion-UUID
    
    The first one allows to turn the feature on or off. The second adds
    the UUID to the client's response, using the header specified on
    uuid_header_name. The third one add this header to the proxy's
    request. This last feature is useful when the origin server
    understands the ID and logs it on its own logs, so one can correlate
    ATS logs for one request with origin's logs for the same request.

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/aziontech/trafficserver uuid

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/trafficserver/pull/106.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #106
    
----
commit b035bd72222616ad3ce546b315e9795a6be988c9
Author: Acácio Centeno <acaciocent...@gmail.com>
Date:   2014-08-28T19:59:15Z

    UUID implementation

commit 9b8fd750f6d8cee00fcf9e052a67b160fafcdb2c
Author: Acácio Centeno <acaciocent...@gmail.com>
Date:   2014-08-29T13:45:16Z

    Minor improvement on UUID generation.

commit 74d53901df68f7b1a4ad50cd60321458246e7e7d
Author: Acácio Centeno <acaciocent...@gmail.com>
Date:   2014-09-01T21:31:16Z

    Small improvements on autoconf.ac

----


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

Reply via email to