application_insights 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
 - data/.gitignore +40 -0
 - data/Gemfile +4 -0
 - data/LICENSE.txt +22 -0
 - data/README.md +106 -0
 - data/Rakefile +10 -0
 - data/application_insights.gemspec +25 -0
 - data/lib/application_insights.rb +2 -0
 - data/lib/application_insights/channel/contracts/application.rb +35 -0
 - data/lib/application_insights/channel/contracts/data.rb +47 -0
 - data/lib/application_insights/channel/contracts/data_point.rb +125 -0
 - data/lib/application_insights/channel/contracts/data_point_type.rb +16 -0
 - data/lib/application_insights/channel/contracts/dependency_kind.rb +22 -0
 - data/lib/application_insights/channel/contracts/dependency_source_type.rb +19 -0
 - data/lib/application_insights/channel/contracts/device.rb +243 -0
 - data/lib/application_insights/channel/contracts/envelope.rb +254 -0
 - data/lib/application_insights/channel/contracts/event_data.rb +77 -0
 - data/lib/application_insights/channel/contracts/exception_data.rb +105 -0
 - data/lib/application_insights/channel/contracts/exception_details.rb +125 -0
 - data/lib/application_insights/channel/contracts/internal.rb +51 -0
 - data/lib/application_insights/channel/contracts/json_serializable.rb +59 -0
 - data/lib/application_insights/channel/contracts/location.rb +35 -0
 - data/lib/application_insights/channel/contracts/message_data.rb +76 -0
 - data/lib/application_insights/channel/contracts/metric_data.rb +60 -0
 - data/lib/application_insights/channel/contracts/operation.rb +83 -0
 - data/lib/application_insights/channel/contracts/page_view_data.rb +109 -0
 - data/lib/application_insights/channel/contracts/remote_dependency_data.rb +218 -0
 - data/lib/application_insights/channel/contracts/request_data.rb +173 -0
 - data/lib/application_insights/channel/contracts/session.rb +67 -0
 - data/lib/application_insights/channel/contracts/severity_level.rb +25 -0
 - data/lib/application_insights/channel/contracts/stack_frame.rb +91 -0
 - data/lib/application_insights/channel/contracts/user.rb +83 -0
 - data/lib/application_insights/channel/queue_base.rb +48 -0
 - data/lib/application_insights/channel/sender_base.rb +46 -0
 - data/lib/application_insights/channel/synchronous_queue.rb +28 -0
 - data/lib/application_insights/channel/synchronous_sender.rb +13 -0
 - data/lib/application_insights/channel/telemetry_channel.rb +81 -0
 - data/lib/application_insights/channel/telemetry_context.rb +49 -0
 - data/lib/application_insights/telemetry_client.rb +111 -0
 - data/lib/application_insights/version.rb +3 -0
 - data/test/application_insights.rb +9 -0
 - data/test/application_insights/channel/contracts/test_application.rb +31 -0
 - data/test/application_insights/channel/contracts/test_data.rb +44 -0
 - data/test/application_insights/channel/contracts/test_data_point.rb +109 -0
 - data/test/application_insights/channel/contracts/test_device.rb +200 -0
 - data/test/application_insights/channel/contracts/test_envelope.rb +209 -0
 - data/test/application_insights/channel/contracts/test_event_data.rb +62 -0
 - data/test/application_insights/channel/contracts/test_exception_data.rb +85 -0
 - data/test/application_insights/channel/contracts/test_exception_details.rb +106 -0
 - data/test/application_insights/channel/contracts/test_internal.rb +44 -0
 - data/test/application_insights/channel/contracts/test_location.rb +31 -0
 - data/test/application_insights/channel/contracts/test_message_data.rb +66 -0
 - data/test/application_insights/channel/contracts/test_metric_data.rb +50 -0
 - data/test/application_insights/channel/contracts/test_operation.rb +70 -0
 - data/test/application_insights/channel/contracts/test_page_view_data.rb +88 -0
 - data/test/application_insights/channel/contracts/test_remote_dependency_data.rb +183 -0
 - data/test/application_insights/channel/contracts/test_request_data.rb +153 -0
 - data/test/application_insights/channel/contracts/test_session.rb +57 -0
 - data/test/application_insights/channel/contracts/test_stack_frame.rb +83 -0
 - data/test/application_insights/channel/contracts/test_user.rb +70 -0
 - data/test/application_insights/channel/test_queue_base.rb +88 -0
 - data/test/application_insights/channel/test_sender_base.rb +96 -0
 - data/test/application_insights/channel/test_synchronous_queue.rb +42 -0
 - data/test/application_insights/channel/test_synchronous_sender.rb +11 -0
 - data/test/application_insights/channel/test_telemetry_channel.rb +102 -0
 - data/test/application_insights/channel/test_telemetry_context.rb +72 -0
 - data/test/application_insights/test_telemetry_client.rb +107 -0
 - metadata +166 -0
 
    
        checksums.yaml
    ADDED
    
    | 
         @@ -0,0 +1,15 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            ---
         
     | 
| 
      
 2 
     | 
    
         
            +
            !binary "U0hBMQ==":
         
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 4 
     | 
    
         
            +
                YTljZjhhZmU0YjRhZDdkMTlmYWMwODM2ZDUyZWFhZDgyZmQ5Yzk4Ng==
         
     | 
| 
      
 5 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 6 
     | 
    
         
            +
                OWNkZTZhNmE3ODAyOGE4N2JkYTEwNzA3MzI3ODM3NGZhNjJiMTc4YQ==
         
     | 
| 
      
 7 
     | 
    
         
            +
            SHA512:
         
     | 
| 
      
 8 
     | 
    
         
            +
              metadata.gz: !binary |-
         
     | 
| 
      
 9 
     | 
    
         
            +
                ZGVlMzFlMjE3OTQyNGUyNzY1NWUyNGU5YjljYjY3MmQwN2RiYzNlZTNkMGNm
         
     | 
| 
      
 10 
     | 
    
         
            +
                YWQ0MDNmMjUyZDJmNzM0OGJmMjQzNGY5NzMyYTQ2ZWQxOGY1YWUzNDIxYzVk
         
     | 
| 
      
 11 
     | 
    
         
            +
                ZTQ4YjUwMWYwMWM1NmNmZjRiMzZmMDkyYTc2OTY1NDAyOTBhNjM=
         
     | 
| 
      
 12 
     | 
    
         
            +
              data.tar.gz: !binary |-
         
     | 
| 
      
 13 
     | 
    
         
            +
                OGM0MTAwYmUxZGJkN2VjMjFiNWZmNDIzMmU1NTk4YTAyNDc1MzQxZGNiZDYw
         
     | 
| 
      
 14 
     | 
    
         
            +
                YjhhYWUzNGZmODA1ZWVmNDk3M2NmZjE3YWJmZjUwMmIzOGNkNjg4YzhiMDYz
         
     | 
| 
      
 15 
     | 
    
         
            +
                NmEwOWRmZjkyOTU4MTUyYTg3Y2YyYjFhZWZhZGM5ZWU1Yzk1OWE=
         
     | 
    
        data/.gitignore
    ADDED
    
    | 
         @@ -0,0 +1,40 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            *.gem
         
     | 
| 
      
 2 
     | 
    
         
            +
            *.rbc
         
     | 
| 
      
 3 
     | 
    
         
            +
            *.bundle
         
     | 
| 
      
 4 
     | 
    
         
            +
            mkmf.log
         
     | 
| 
      
 5 
     | 
    
         
            +
            /.config
         
     | 
| 
      
 6 
     | 
    
         
            +
            /coverage/
         
     | 
| 
      
 7 
     | 
    
         
            +
            /InstalledFiles
         
     | 
| 
      
 8 
     | 
    
         
            +
            /doc/
         
     | 
| 
      
 9 
     | 
    
         
            +
            /pkg/
         
     | 
| 
      
 10 
     | 
    
         
            +
            /spec/reports/
         
     | 
| 
      
 11 
     | 
    
         
            +
            /test/tmp/
         
     | 
| 
      
 12 
     | 
    
         
            +
            /test/version_tmp/
         
     | 
| 
      
 13 
     | 
    
         
            +
            /tmp/
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            ## Specific to RubyMotion:
         
     | 
| 
      
 16 
     | 
    
         
            +
            .dat*
         
     | 
| 
      
 17 
     | 
    
         
            +
            .repl_history
         
     | 
| 
      
 18 
     | 
    
         
            +
            build/
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
            ## Specific to RubyMine:
         
     | 
| 
      
 21 
     | 
    
         
            +
            /.idea/
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            ## Documentation cache and generated files:
         
     | 
| 
      
 24 
     | 
    
         
            +
            /.yardoc/
         
     | 
| 
      
 25 
     | 
    
         
            +
            /_yardoc/
         
     | 
| 
      
 26 
     | 
    
         
            +
            /doc/
         
     | 
| 
      
 27 
     | 
    
         
            +
            /rdoc/
         
     | 
| 
      
 28 
     | 
    
         
            +
             
     | 
| 
      
 29 
     | 
    
         
            +
            ## Environment normalisation:
         
     | 
| 
      
 30 
     | 
    
         
            +
            /.bundle/
         
     | 
| 
      
 31 
     | 
    
         
            +
            /lib/bundler/man/
         
     | 
| 
      
 32 
     | 
    
         
            +
             
     | 
| 
      
 33 
     | 
    
         
            +
            # for a library or gem, you might want to ignore these files since the code is
         
     | 
| 
      
 34 
     | 
    
         
            +
            # intended to run in multiple environments; otherwise, check them in:
         
     | 
| 
      
 35 
     | 
    
         
            +
            Gemfile.lock
         
     | 
| 
      
 36 
     | 
    
         
            +
            .ruby-version
         
     | 
| 
      
 37 
     | 
    
         
            +
            .ruby-gemset
         
     | 
| 
      
 38 
     | 
    
         
            +
             
     | 
| 
      
 39 
     | 
    
         
            +
            # unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
         
     | 
| 
      
 40 
     | 
    
         
            +
            .rvmrc
         
     | 
    
        data/Gemfile
    ADDED
    
    
    
        data/LICENSE.txt
    ADDED
    
    | 
         @@ -0,0 +1,22 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            The MIT License (MIT)
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            Copyright (c) 2014 Microsoft
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
      
 5 
     | 
    
         
            +
            Permission is hereby granted, free of charge, to any person obtaining a copy
         
     | 
| 
      
 6 
     | 
    
         
            +
            of this software and associated documentation files (the "Software"), to deal
         
     | 
| 
      
 7 
     | 
    
         
            +
            in the Software without restriction, including without limitation the rights
         
     | 
| 
      
 8 
     | 
    
         
            +
            to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
         
     | 
| 
      
 9 
     | 
    
         
            +
            copies of the Software, and to permit persons to whom the Software is
         
     | 
| 
      
 10 
     | 
    
         
            +
            furnished to do so, subject to the following conditions:
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
            The above copyright notice and this permission notice shall be included in all
         
     | 
| 
      
 13 
     | 
    
         
            +
            copies or substantial portions of the Software.
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         
     | 
| 
      
 16 
     | 
    
         
            +
            IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         
     | 
| 
      
 17 
     | 
    
         
            +
            FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         
     | 
| 
      
 18 
     | 
    
         
            +
            AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         
     | 
| 
      
 19 
     | 
    
         
            +
            LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
         
     | 
| 
      
 20 
     | 
    
         
            +
            OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
         
     | 
| 
      
 21 
     | 
    
         
            +
            SOFTWARE.
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
    
        data/README.md
    ADDED
    
    | 
         @@ -0,0 +1,106 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # Application Insights SDK for Ruby #
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            >Ruby is a dynamic, open source programming language with a focus on simplicity and productivity. It has an elegant syntax that is natural to read and easy to write. 
         
     | 
| 
      
 4 
     | 
    
         
            +
            > -- <cite>[Ruby - Official Site](https://www.ruby-lang.org/en/)</cite>
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            This project extends the Application Insights API surface to support Ruby. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) is a service that allows developers to keep their application available, performing and succeeding. This Ruby gem will allow you to send telemetry of various kinds (event, trace, exception, etc.) to the Application Insights service where they can be visualized in the Azure Portal. 
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
            ## Requirements ##
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            Ruby 1.9.3 is currently supported by this gem. 
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            ## Installation ##
         
     | 
| 
      
 14 
     | 
    
         
            +
             
     | 
| 
      
 15 
     | 
    
         
            +
            To install the latest release you can use *gem*.
         
     | 
| 
      
 16 
     | 
    
         
            +
             
     | 
| 
      
 17 
     | 
    
         
            +
            ```
         
     | 
| 
      
 18 
     | 
    
         
            +
            $ gem install application_insights
         
     | 
| 
      
 19 
     | 
    
         
            +
            ```
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
            ## Usage ##
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
            Once installed, you can send telemetry to Application Insights. Here are a few samples.
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            >**Note**: before you can send data to you will need an instrumentation key. Please see the [Getting an Application Insights Instrumentation Key](https://github.com/Microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key) section for more information.
         
     | 
| 
      
 26 
     | 
    
         
            +
             
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            **Sending a simple event telemetry item**
         
     | 
| 
      
 29 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 30 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 31 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 32 
     | 
    
         
            +
            tc.context.instrumentation_key = '<YOUR INSTRUMENTATION KEY GOES HERE>'
         
     | 
| 
      
 33 
     | 
    
         
            +
            tc.track_event 'My event'
         
     | 
| 
      
 34 
     | 
    
         
            +
            tc.flush
         
     | 
| 
      
 35 
     | 
    
         
            +
            ```
         
     | 
| 
      
 36 
     | 
    
         
            +
             
     | 
| 
      
 37 
     | 
    
         
            +
            **Sending an event telemetry item with custom properties and measurements**
         
     | 
| 
      
 38 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 39 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 40 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 41 
     | 
    
         
            +
            tc.context.instrumentation_key = '<YOUR INSTRUMENTATION KEY GOES HERE>'
         
     | 
| 
      
 42 
     | 
    
         
            +
            tc.track_event 'My event', :properties => { 'custom property' => 'some value' }, :measurements => { 'custom metric' => 13 }
         
     | 
| 
      
 43 
     | 
    
         
            +
            tc.flush
         
     | 
| 
      
 44 
     | 
    
         
            +
            ```
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
            **Sending a trace telemetry item with custom properties**
         
     | 
| 
      
 47 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 48 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 49 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 50 
     | 
    
         
            +
            tc.context.instrumentation_key = '<YOUR INSTRUMENTATION KEY GOES HERE>'
         
     | 
| 
      
 51 
     | 
    
         
            +
            tc.track_trace 'My trace statement', :properties => { 'custom property' => 'some value' }
         
     | 
| 
      
 52 
     | 
    
         
            +
            tc.flush
         
     | 
| 
      
 53 
     | 
    
         
            +
            ```  
         
     | 
| 
      
 54 
     | 
    
         
            +
             
     | 
| 
      
 55 
     | 
    
         
            +
            **Sending a metric telemetry item (without and with optional values)**
         
     | 
| 
      
 56 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 57 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 58 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 59 
     | 
    
         
            +
            tc.context.instrumentation_key = '<YOUR INSTRUMENTATION KEY GOES HERE>'
         
     | 
| 
      
 60 
     | 
    
         
            +
            tc.track_metric 'My metric', 42
         
     | 
| 
      
 61 
     | 
    
         
            +
            # with all optional values set
         
     | 
| 
      
 62 
     | 
    
         
            +
            tc.track_metric 'My metric', 42, :kind => ApplicationInsights::Channel::Contracts::DataPointType::AGGREGATION, :count => 3, :min => 1, :max => 100, :std_dev => 10, :properties => { 'custom property' => 'some value' }
         
     | 
| 
      
 63 
     | 
    
         
            +
            tc.flush
         
     | 
| 
      
 64 
     | 
    
         
            +
            ``` 
         
     | 
| 
      
 65 
     | 
    
         
            +
             
     | 
| 
      
 66 
     | 
    
         
            +
            **Sending an exception telemetry item with custom properties and measurements**
         
     | 
| 
      
 67 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 68 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 69 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 70 
     | 
    
         
            +
            tc.context.instrumentation_key = '<YOUR INSTRUMENTATION KEY GOES HERE>'
         
     | 
| 
      
 71 
     | 
    
         
            +
            begin
         
     | 
| 
      
 72 
     | 
    
         
            +
              raise ArgumentError, 'Something has gone wrong!'
         
     | 
| 
      
 73 
     | 
    
         
            +
            rescue => e
         
     | 
| 
      
 74 
     | 
    
         
            +
              tc.track_exception e
         
     | 
| 
      
 75 
     | 
    
         
            +
            end
         
     | 
| 
      
 76 
     | 
    
         
            +
            tc.flush
         
     | 
| 
      
 77 
     | 
    
         
            +
            ```  
         
     | 
| 
      
 78 
     | 
    
         
            +
             
     | 
| 
      
 79 
     | 
    
         
            +
            **Configuring context for a telemetry client instance**
         
     | 
| 
      
 80 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 81 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 82 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 83 
     | 
    
         
            +
            tc.context.instrumentation_key = '<YOUR INSTRUMENTATION KEY GOES HERE>'
         
     | 
| 
      
 84 
     | 
    
         
            +
            tc.context.application.id = 'My application'
         
     | 
| 
      
 85 
     | 
    
         
            +
            tc.context.application.ver = '1.2.3'
         
     | 
| 
      
 86 
     | 
    
         
            +
            tc.context.device.id = 'My current device'
         
     | 
| 
      
 87 
     | 
    
         
            +
            tc.context.device.oem_name = 'Asus'
         
     | 
| 
      
 88 
     | 
    
         
            +
            tc.context.device.model = 'X31A'
         
     | 
| 
      
 89 
     | 
    
         
            +
            tc.context.device.type = "Other"
         
     | 
| 
      
 90 
     | 
    
         
            +
            tc.context.user.id = 'santa@northpole.net'
         
     | 
| 
      
 91 
     | 
    
         
            +
            tc.track_trace 'My trace with context'
         
     | 
| 
      
 92 
     | 
    
         
            +
            tc.flush
         
     | 
| 
      
 93 
     | 
    
         
            +
            ```  
         
     | 
| 
      
 94 
     | 
    
         
            +
             
     | 
| 
      
 95 
     | 
    
         
            +
            **Configuring channel related properties**
         
     | 
| 
      
 96 
     | 
    
         
            +
            ```ruby
         
     | 
| 
      
 97 
     | 
    
         
            +
            require 'application_insights'
         
     | 
| 
      
 98 
     | 
    
         
            +
            tc = ApplicationInsights::TelemetryClient.new
         
     | 
| 
      
 99 
     | 
    
         
            +
            # flush telemetry if we have 10 or more telemetry items in our queue
         
     | 
| 
      
 100 
     | 
    
         
            +
            tc.channel.queue.max_queue_length = 10
         
     | 
| 
      
 101 
     | 
    
         
            +
            # send telemetry to the service in batches of 5
         
     | 
| 
      
 102 
     | 
    
         
            +
            tc.channel.sender.send_buffer_size = 5
         
     | 
| 
      
 103 
     | 
    
         
            +
            ```
         
     | 
| 
      
 104 
     | 
    
         
            +
             
     | 
| 
      
 105 
     | 
    
         
            +
             
     | 
| 
      
 106 
     | 
    
         
            +
             
     | 
    
        data/Rakefile
    ADDED
    
    
| 
         @@ -0,0 +1,25 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            # coding: utf-8
         
     | 
| 
      
 2 
     | 
    
         
            +
            lib = File.expand_path('../lib', __FILE__)
         
     | 
| 
      
 3 
     | 
    
         
            +
            $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
         
     | 
| 
      
 4 
     | 
    
         
            +
            require 'application_insights/version'
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
            Gem::Specification.new do |spec|
         
     | 
| 
      
 7 
     | 
    
         
            +
              spec.name          = 'application_insights'
         
     | 
| 
      
 8 
     | 
    
         
            +
              spec.version       = ApplicationInsights::VERSION
         
     | 
| 
      
 9 
     | 
    
         
            +
              spec.authors       = ['Microsoft']
         
     | 
| 
      
 10 
     | 
    
         
            +
              spec.email         = ['aiengdisc@microsoft.com']
         
     | 
| 
      
 11 
     | 
    
         
            +
              spec.summary       = %q{Application Insights SDK for Ruby}
         
     | 
| 
      
 12 
     | 
    
         
            +
              spec.description   = %q{This project extends the Application Insights API surface to support Ruby.}
         
     | 
| 
      
 13 
     | 
    
         
            +
              spec.homepage      = 'https://github.com/Microsoft/AppInsights-Ruby'
         
     | 
| 
      
 14 
     | 
    
         
            +
              spec.license       = 'MIT'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
              spec.files         = `git ls-files -z`.split("\x0")
         
     | 
| 
      
 17 
     | 
    
         
            +
              spec.executables   = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
         
     | 
| 
      
 18 
     | 
    
         
            +
              spec.test_files    = spec.files.grep(%r{^(test|spec|features)/})
         
     | 
| 
      
 19 
     | 
    
         
            +
              spec.require_paths = ['lib']
         
     | 
| 
      
 20 
     | 
    
         
            +
             
     | 
| 
      
 21 
     | 
    
         
            +
              spec.required_ruby_version = '>= 1.9.3'
         
     | 
| 
      
 22 
     | 
    
         
            +
             
     | 
| 
      
 23 
     | 
    
         
            +
              spec.add_development_dependency 'bundler', '~> 1.7'
         
     | 
| 
      
 24 
     | 
    
         
            +
              spec.add_development_dependency 'rake', '~> 10.0'
         
     | 
| 
      
 25 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,35 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'json_serializable'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ApplicationInsights
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Channel
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Contracts
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Data contract class for type Application.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  class Application < JsonSerializable
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initializes a new instance of the Application class.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    def initialize(options={})
         
     | 
| 
      
 10 
     | 
    
         
            +
                      defaults = {
         
     | 
| 
      
 11 
     | 
    
         
            +
                        'ai.application.ver' => nil
         
     | 
| 
      
 12 
     | 
    
         
            +
                      }
         
     | 
| 
      
 13 
     | 
    
         
            +
                      values = {
         
     | 
| 
      
 14 
     | 
    
         
            +
                      }
         
     | 
| 
      
 15 
     | 
    
         
            +
                      super defaults, values, options
         
     | 
| 
      
 16 
     | 
    
         
            +
                    end
         
     | 
| 
      
 17 
     | 
    
         
            +
                    
         
     | 
| 
      
 18 
     | 
    
         
            +
                    # Gets the ver property.
         
     | 
| 
      
 19 
     | 
    
         
            +
                    def ver
         
     | 
| 
      
 20 
     | 
    
         
            +
                      return @values['ai.application.ver'] if @values.key?('ai.application.ver')
         
     | 
| 
      
 21 
     | 
    
         
            +
                      @defaults['ai.application.ver']
         
     | 
| 
      
 22 
     | 
    
         
            +
                    end
         
     | 
| 
      
 23 
     | 
    
         
            +
                    
         
     | 
| 
      
 24 
     | 
    
         
            +
                    # Sets the ver property.
         
     | 
| 
      
 25 
     | 
    
         
            +
                    def ver=(value)
         
     | 
| 
      
 26 
     | 
    
         
            +
                      if value == @defaults['ai.application.ver']
         
     | 
| 
      
 27 
     | 
    
         
            +
                        @values.delete 'ai.application.ver' if @values.key? 'ai.application.ver'
         
     | 
| 
      
 28 
     | 
    
         
            +
                      else
         
     | 
| 
      
 29 
     | 
    
         
            +
                        @values['ai.application.ver'] = value
         
     | 
| 
      
 30 
     | 
    
         
            +
                      end
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
                end
         
     | 
| 
      
 34 
     | 
    
         
            +
              end
         
     | 
| 
      
 35 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,47 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'json_serializable'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ApplicationInsights
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Channel
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Contracts
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Data contract class for type Data.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  class Data < JsonSerializable
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Initializes a new instance of the Data class.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    def initialize(options={})
         
     | 
| 
      
 10 
     | 
    
         
            +
                      defaults = {
         
     | 
| 
      
 11 
     | 
    
         
            +
                        'baseType' => nil,
         
     | 
| 
      
 12 
     | 
    
         
            +
                        'baseData' => nil
         
     | 
| 
      
 13 
     | 
    
         
            +
                      }
         
     | 
| 
      
 14 
     | 
    
         
            +
                      values = {
         
     | 
| 
      
 15 
     | 
    
         
            +
                        'baseData' => nil
         
     | 
| 
      
 16 
     | 
    
         
            +
                      }
         
     | 
| 
      
 17 
     | 
    
         
            +
                      super defaults, values, options
         
     | 
| 
      
 18 
     | 
    
         
            +
                    end
         
     | 
| 
      
 19 
     | 
    
         
            +
                    
         
     | 
| 
      
 20 
     | 
    
         
            +
                    # Gets the base_type property.
         
     | 
| 
      
 21 
     | 
    
         
            +
                    def base_type
         
     | 
| 
      
 22 
     | 
    
         
            +
                      return @values['baseType'] if @values.key?('baseType')
         
     | 
| 
      
 23 
     | 
    
         
            +
                      @defaults['baseType']
         
     | 
| 
      
 24 
     | 
    
         
            +
                    end
         
     | 
| 
      
 25 
     | 
    
         
            +
                    
         
     | 
| 
      
 26 
     | 
    
         
            +
                    # Sets the base_type property.
         
     | 
| 
      
 27 
     | 
    
         
            +
                    def base_type=(value)
         
     | 
| 
      
 28 
     | 
    
         
            +
                      if value == @defaults['baseType']
         
     | 
| 
      
 29 
     | 
    
         
            +
                        @values.delete 'baseType' if @values.key? 'baseType'
         
     | 
| 
      
 30 
     | 
    
         
            +
                      else
         
     | 
| 
      
 31 
     | 
    
         
            +
                        @values['baseType'] = value
         
     | 
| 
      
 32 
     | 
    
         
            +
                      end
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                    
         
     | 
| 
      
 35 
     | 
    
         
            +
                    # Gets the base_data property.
         
     | 
| 
      
 36 
     | 
    
         
            +
                    def base_data
         
     | 
| 
      
 37 
     | 
    
         
            +
                      @values['baseData']
         
     | 
| 
      
 38 
     | 
    
         
            +
                    end
         
     | 
| 
      
 39 
     | 
    
         
            +
                    
         
     | 
| 
      
 40 
     | 
    
         
            +
                    # Sets the base_data property.
         
     | 
| 
      
 41 
     | 
    
         
            +
                    def base_data=(value)
         
     | 
| 
      
 42 
     | 
    
         
            +
                      @values['baseData'] = value
         
     | 
| 
      
 43 
     | 
    
         
            +
                    end
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
                end
         
     | 
| 
      
 46 
     | 
    
         
            +
              end
         
     | 
| 
      
 47 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,125 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'json_serializable'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ApplicationInsights
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Channel
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Contracts
         
     | 
| 
      
 6 
     | 
    
         
            +
                  require_relative 'data_point_type'
         
     | 
| 
      
 7 
     | 
    
         
            +
                  # Data contract class for type DataPoint.
         
     | 
| 
      
 8 
     | 
    
         
            +
                  class DataPoint < JsonSerializable
         
     | 
| 
      
 9 
     | 
    
         
            +
                    # Initializes a new instance of the DataPoint class.
         
     | 
| 
      
 10 
     | 
    
         
            +
                    def initialize(options={})
         
     | 
| 
      
 11 
     | 
    
         
            +
                      defaults = {
         
     | 
| 
      
 12 
     | 
    
         
            +
                        'name' => nil,
         
     | 
| 
      
 13 
     | 
    
         
            +
                        'kind' => DataPointType::MEASUREMENT,
         
     | 
| 
      
 14 
     | 
    
         
            +
                        'value' => nil,
         
     | 
| 
      
 15 
     | 
    
         
            +
                        'count' => nil,
         
     | 
| 
      
 16 
     | 
    
         
            +
                        'min' => nil,
         
     | 
| 
      
 17 
     | 
    
         
            +
                        'max' => nil,
         
     | 
| 
      
 18 
     | 
    
         
            +
                        'stdDev' => nil
         
     | 
| 
      
 19 
     | 
    
         
            +
                      }
         
     | 
| 
      
 20 
     | 
    
         
            +
                      values = {
         
     | 
| 
      
 21 
     | 
    
         
            +
                        'name' => nil,
         
     | 
| 
      
 22 
     | 
    
         
            +
                        'kind' => DataPointType::MEASUREMENT,
         
     | 
| 
      
 23 
     | 
    
         
            +
                        'value' => nil
         
     | 
| 
      
 24 
     | 
    
         
            +
                      }
         
     | 
| 
      
 25 
     | 
    
         
            +
                      super defaults, values, options
         
     | 
| 
      
 26 
     | 
    
         
            +
                    end
         
     | 
| 
      
 27 
     | 
    
         
            +
                    
         
     | 
| 
      
 28 
     | 
    
         
            +
                    # Gets the name property.
         
     | 
| 
      
 29 
     | 
    
         
            +
                    def name
         
     | 
| 
      
 30 
     | 
    
         
            +
                      @values['name']
         
     | 
| 
      
 31 
     | 
    
         
            +
                    end
         
     | 
| 
      
 32 
     | 
    
         
            +
                    
         
     | 
| 
      
 33 
     | 
    
         
            +
                    # Sets the name property.
         
     | 
| 
      
 34 
     | 
    
         
            +
                    def name=(value)
         
     | 
| 
      
 35 
     | 
    
         
            +
                      @values['name'] = value
         
     | 
| 
      
 36 
     | 
    
         
            +
                    end
         
     | 
| 
      
 37 
     | 
    
         
            +
                    
         
     | 
| 
      
 38 
     | 
    
         
            +
                    # Gets the kind property.
         
     | 
| 
      
 39 
     | 
    
         
            +
                    def kind
         
     | 
| 
      
 40 
     | 
    
         
            +
                      return @values['kind'] if @values.key?('kind')
         
     | 
| 
      
 41 
     | 
    
         
            +
                      @defaults['kind']
         
     | 
| 
      
 42 
     | 
    
         
            +
                    end
         
     | 
| 
      
 43 
     | 
    
         
            +
                    
         
     | 
| 
      
 44 
     | 
    
         
            +
                    # Sets the kind property.
         
     | 
| 
      
 45 
     | 
    
         
            +
                    def kind=(value)
         
     | 
| 
      
 46 
     | 
    
         
            +
                      if value == @defaults['kind']
         
     | 
| 
      
 47 
     | 
    
         
            +
                        @values.delete 'kind' if @values.key? 'kind'
         
     | 
| 
      
 48 
     | 
    
         
            +
                      else
         
     | 
| 
      
 49 
     | 
    
         
            +
                        @values['kind'] = value
         
     | 
| 
      
 50 
     | 
    
         
            +
                      end
         
     | 
| 
      
 51 
     | 
    
         
            +
                    end
         
     | 
| 
      
 52 
     | 
    
         
            +
                    
         
     | 
| 
      
 53 
     | 
    
         
            +
                    # Gets the value property.
         
     | 
| 
      
 54 
     | 
    
         
            +
                    def value
         
     | 
| 
      
 55 
     | 
    
         
            +
                      @values['value']
         
     | 
| 
      
 56 
     | 
    
         
            +
                    end
         
     | 
| 
      
 57 
     | 
    
         
            +
                    
         
     | 
| 
      
 58 
     | 
    
         
            +
                    # Sets the value property.
         
     | 
| 
      
 59 
     | 
    
         
            +
                    def value=(value)
         
     | 
| 
      
 60 
     | 
    
         
            +
                      @values['value'] = value
         
     | 
| 
      
 61 
     | 
    
         
            +
                    end
         
     | 
| 
      
 62 
     | 
    
         
            +
                    
         
     | 
| 
      
 63 
     | 
    
         
            +
                    # Gets the count property.
         
     | 
| 
      
 64 
     | 
    
         
            +
                    def count
         
     | 
| 
      
 65 
     | 
    
         
            +
                      return @values['count'] if @values.key?('count')
         
     | 
| 
      
 66 
     | 
    
         
            +
                      @defaults['count']
         
     | 
| 
      
 67 
     | 
    
         
            +
                    end
         
     | 
| 
      
 68 
     | 
    
         
            +
                    
         
     | 
| 
      
 69 
     | 
    
         
            +
                    # Sets the count property.
         
     | 
| 
      
 70 
     | 
    
         
            +
                    def count=(value)
         
     | 
| 
      
 71 
     | 
    
         
            +
                      if value == @defaults['count']
         
     | 
| 
      
 72 
     | 
    
         
            +
                        @values.delete 'count' if @values.key? 'count'
         
     | 
| 
      
 73 
     | 
    
         
            +
                      else
         
     | 
| 
      
 74 
     | 
    
         
            +
                        @values['count'] = value
         
     | 
| 
      
 75 
     | 
    
         
            +
                      end
         
     | 
| 
      
 76 
     | 
    
         
            +
                    end
         
     | 
| 
      
 77 
     | 
    
         
            +
                    
         
     | 
| 
      
 78 
     | 
    
         
            +
                    # Gets the min property.
         
     | 
| 
      
 79 
     | 
    
         
            +
                    def min
         
     | 
| 
      
 80 
     | 
    
         
            +
                      return @values['min'] if @values.key?('min')
         
     | 
| 
      
 81 
     | 
    
         
            +
                      @defaults['min']
         
     | 
| 
      
 82 
     | 
    
         
            +
                    end
         
     | 
| 
      
 83 
     | 
    
         
            +
                    
         
     | 
| 
      
 84 
     | 
    
         
            +
                    # Sets the min property.
         
     | 
| 
      
 85 
     | 
    
         
            +
                    def min=(value)
         
     | 
| 
      
 86 
     | 
    
         
            +
                      if value == @defaults['min']
         
     | 
| 
      
 87 
     | 
    
         
            +
                        @values.delete 'min' if @values.key? 'min'
         
     | 
| 
      
 88 
     | 
    
         
            +
                      else
         
     | 
| 
      
 89 
     | 
    
         
            +
                        @values['min'] = value
         
     | 
| 
      
 90 
     | 
    
         
            +
                      end
         
     | 
| 
      
 91 
     | 
    
         
            +
                    end
         
     | 
| 
      
 92 
     | 
    
         
            +
                    
         
     | 
| 
      
 93 
     | 
    
         
            +
                    # Gets the max property.
         
     | 
| 
      
 94 
     | 
    
         
            +
                    def max
         
     | 
| 
      
 95 
     | 
    
         
            +
                      return @values['max'] if @values.key?('max')
         
     | 
| 
      
 96 
     | 
    
         
            +
                      @defaults['max']
         
     | 
| 
      
 97 
     | 
    
         
            +
                    end
         
     | 
| 
      
 98 
     | 
    
         
            +
                    
         
     | 
| 
      
 99 
     | 
    
         
            +
                    # Sets the max property.
         
     | 
| 
      
 100 
     | 
    
         
            +
                    def max=(value)
         
     | 
| 
      
 101 
     | 
    
         
            +
                      if value == @defaults['max']
         
     | 
| 
      
 102 
     | 
    
         
            +
                        @values.delete 'max' if @values.key? 'max'
         
     | 
| 
      
 103 
     | 
    
         
            +
                      else
         
     | 
| 
      
 104 
     | 
    
         
            +
                        @values['max'] = value
         
     | 
| 
      
 105 
     | 
    
         
            +
                      end
         
     | 
| 
      
 106 
     | 
    
         
            +
                    end
         
     | 
| 
      
 107 
     | 
    
         
            +
                    
         
     | 
| 
      
 108 
     | 
    
         
            +
                    # Gets the std_dev property.
         
     | 
| 
      
 109 
     | 
    
         
            +
                    def std_dev
         
     | 
| 
      
 110 
     | 
    
         
            +
                      return @values['stdDev'] if @values.key?('stdDev')
         
     | 
| 
      
 111 
     | 
    
         
            +
                      @defaults['stdDev']
         
     | 
| 
      
 112 
     | 
    
         
            +
                    end
         
     | 
| 
      
 113 
     | 
    
         
            +
                    
         
     | 
| 
      
 114 
     | 
    
         
            +
                    # Sets the std_dev property.
         
     | 
| 
      
 115 
     | 
    
         
            +
                    def std_dev=(value)
         
     | 
| 
      
 116 
     | 
    
         
            +
                      if value == @defaults['stdDev']
         
     | 
| 
      
 117 
     | 
    
         
            +
                        @values.delete 'stdDev' if @values.key? 'stdDev'
         
     | 
| 
      
 118 
     | 
    
         
            +
                      else
         
     | 
| 
      
 119 
     | 
    
         
            +
                        @values['stdDev'] = value
         
     | 
| 
      
 120 
     | 
    
         
            +
                      end
         
     | 
| 
      
 121 
     | 
    
         
            +
                    end
         
     | 
| 
      
 122 
     | 
    
         
            +
                  end
         
     | 
| 
      
 123 
     | 
    
         
            +
                end
         
     | 
| 
      
 124 
     | 
    
         
            +
              end
         
     | 
| 
      
 125 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require_relative 'json_serializable'
         
     | 
| 
      
 2 
     | 
    
         
            +
             
     | 
| 
      
 3 
     | 
    
         
            +
            module ApplicationInsights
         
     | 
| 
      
 4 
     | 
    
         
            +
              module Channel
         
     | 
| 
      
 5 
     | 
    
         
            +
                module Contracts
         
     | 
| 
      
 6 
     | 
    
         
            +
                  # Data contract class for type DataPointType.
         
     | 
| 
      
 7 
     | 
    
         
            +
                  class DataPointType
         
     | 
| 
      
 8 
     | 
    
         
            +
                    # Enumeration value MEASUREMENT.
         
     | 
| 
      
 9 
     | 
    
         
            +
                    MEASUREMENT = 0
         
     | 
| 
      
 10 
     | 
    
         
            +
                    
         
     | 
| 
      
 11 
     | 
    
         
            +
                    # Enumeration value AGGREGATION.
         
     | 
| 
      
 12 
     | 
    
         
            +
                    AGGREGATION = 1
         
     | 
| 
      
 13 
     | 
    
         
            +
                  end
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     |