diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index e94f1fa..dfa775d 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -1,4 +1,4 @@ # How to Contribute -If you're interested in contributing, take a look at the general [contributer's guide](https://github.com/Microsoft/ApplicationInsights-Home/blob/master/CONTRIBUTING.md) first. +If you're interested in contributing, take a look at the general [contributer's guide](https://github.com/microsoft/ApplicationInsights-Home/blob/master/CONTRIBUTING.md) first. diff --git a/README.md b/README.md index d58a7ac..977e409 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Microsoft Application Insights SDK for Go -[![Build Status](https://travis-ci.org/Microsoft/ApplicationInsights-Go.svg?branch=master)](https://travis-ci.org/Microsoft/ApplicationInsights-Go) [![Documentation](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go?status.svg)](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights) [![Release](https://img.shields.io/github/release/Microsoft/ApplicationInsights-Go/all.svg)](https://github.com/Microsoft/ApplicationInsights-Go/releases) +[![Build Status](https://travis-ci.org/Microsoft/ApplicationInsights-Go.svg?branch=master)](https://travis-ci.org/Microsoft/ApplicationInsights-Go) [![Documentation](https://godoc.org/github.com/microsoft/ApplicationInsights-Go?status.svg)](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights) [![Release](https://img.shields.io/github/release/Microsoft/ApplicationInsights-Go/all.svg)](https://github.com/microsoft/ApplicationInsights-Go/releases) This project provides a Go SDK for Application Insights. [Application Insights](http://azure.microsoft.com/en-us/services/application-insights/) @@ -25,26 +25,26 @@ some of the more mature SDK's. In particular, the gaps are: Additionally, this is considered a community-supported SDK. Read more about the status of this and other SDK's in the -[ApplicationInsights-Home](https://github.com/Microsoft/ApplicationInsights-Home) +[ApplicationInsights-Home](https://github.com/microsoft/ApplicationInsights-Home) repository. ## Requirements **Install** ``` -go get github.com/Microsoft/ApplicationInsights-Go/appinsights +go get github.com/microsoft/ApplicationInsights-Go/appinsights ``` **Get an instrumentation key** ->**Note**: an instrumentation key is required before any data can be sent. Please see the "[Getting an Application Insights Instrumentation Key](https://github.com/Microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key)" section of the wiki for more information. To try the SDK without an instrumentation key, set the instrumentationKey config value to a non-empty string. +>**Note**: an instrumentation key is required before any data can be sent. Please see the "[Getting an Application Insights Instrumentation Key](https://github.com/microsoft/AppInsights-Home/wiki#getting-an-application-insights-instrumentation-key)" section of the wiki for more information. To try the SDK without an instrumentation key, set the instrumentationKey config value to a non-empty string. # Usage ## Setup To start tracking telemetry, you'll want to first initialize a -[telemetry client](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#TelemetryClient). +[telemetry client](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#TelemetryClient). ```go -import "github.com/Microsoft/ApplicationInsights-Go/appinsights" +import "github.com/microsoft/ApplicationInsights-Go/appinsights" func main() { client := appinsights.NewTelemetryClient("") @@ -52,12 +52,12 @@ func main() { ``` If you want more control over the client's behavior, you should initialize a -new [TelemetryConfiguration](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#TelemetryConfiguration) +new [TelemetryConfiguration](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#TelemetryConfiguration) object and use it to create a client: ```go import "time" -import "github.com/Microsoft/ApplicationInsights-Go/appinsights" +import "github.com/microsoft/ApplicationInsights-Go/appinsights" func main() { telemetryConfig := appinsights.NewTelemetryConfiguration("") @@ -80,7 +80,7 @@ it in your data model. ## Telemetry submission -The [TelemetryClient](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#TelemetryClient) +The [TelemetryClient](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#TelemetryClient) itself has several methods for submitting telemetry: ```go @@ -132,7 +132,7 @@ then be submitted through the `TelemetryClient.Track` method, as illustrated in the below sections: ### Trace -[Trace telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#TraceTelemetry) +[Trace telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#TraceTelemetry) represent printf-like trace statements that can be text searched. They have an associated severity level, values for which are found in the package's constants: @@ -164,7 +164,7 @@ client.Track(trace) ``` ### Events -[Event telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#EventTelemetry) +[Event telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#EventTelemetry) represent structured event records. ```go @@ -174,7 +174,7 @@ client.Track(event) ``` ### Single-value metrics -[Metric telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#MetricTelemetry) +[Metric telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#MetricTelemetry) each represent a single data point. ```go @@ -186,7 +186,7 @@ client.Track(metric) ### Pre-aggregated metrics To reduce the number of metric values that may be sent through telemetry, when using a particularly high volume of measurements, metric data can be -[pre-aggregated by the client](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#AggregateMetricTelemetry) +[pre-aggregated by the client](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#AggregateMetricTelemetry) and submitted all at once. ```go @@ -219,7 +219,7 @@ client.Track(aggregate) ``` ### Requests -[Request telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#RequestTelemetry) +[Request telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#RequestTelemetry) represent completion of an external request to the application and contains a summary of that request execution and results. This SDK's request telemetry is focused on HTTP requests. @@ -254,7 +254,7 @@ client.Track(request) ``` ### Dependencies -[Remote dependency telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#RemoteDependencyTelemetry) +[Remote dependency telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#RemoteDependencyTelemetry) represent interactions of the monitored component with a remote component/service like SQL or an HTTP endpoint. @@ -285,7 +285,7 @@ client.Track(dependency) ``` ### Exceptions -[Exception telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#ExceptionTelemetry) +[Exception telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#ExceptionTelemetry) represent handled or unhandled exceptions that occurred during the execution of the monitored application. This SDK is geared towards handling panics or unexpected results from important functions: @@ -357,7 +357,7 @@ if err != nil { ``` ### Availability -[Availability telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights/#AvailabilityTelemetry) +[Availability telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights/#AvailabilityTelemetry) represent the result of executing an availability test. This is useful if you are writing availability monitors in Go. @@ -382,7 +382,7 @@ client.Track(availability) ``` ### Page Views -[Page view telemetry items](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights/#PageViewTelemetry) +[Page view telemetry items](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights/#PageViewTelemetry) represent generic actions on a page like a button click. These are typically generated by the client side rather than the server side, but is available here nonetheless. @@ -403,10 +403,10 @@ client.Track(pageview) Telemetry items all have a `Tags` property that contains information *about* the submitted telemetry, such as user, session, and device information. The `Tags` property is an instance of the -[contracts.ContextTags](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts/#ContextTags) +[contracts.ContextTags](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights/contracts/#ContextTags) type, which is a `map[string]string` under the hood, but has helper methods to access the most commonly used data. An instance of -[TelemetryContext](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights/#TelemetryContext) +[TelemetryContext](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights/#TelemetryContext) exists on the `TelemetryClient`, and also contains a `Tags` property. These tags are applied to all telemetry sent through the client. If a context tag is found on both the client's `TelemetryContext` and in the telemetry item's @@ -418,8 +418,8 @@ A few examples for illustration: import ( "os" - "github.com/Microsoft/ApplicationInsights-Go/appinsights" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) func main() { @@ -465,7 +465,7 @@ func main() { ``` ### Shutdown -The Go SDK submits data asynchronously. The [InMemoryChannel](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights/#InMemoryChannel) +The Go SDK submits data asynchronously. The [InMemoryChannel](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights/#InMemoryChannel) launches its own goroutine used to accept and send telemetry. If you're not careful, this may result in lost telemetry when the service needs to shut down. The channel has a few methods to deal with this case: @@ -513,7 +513,7 @@ func main() { We recommend something similar to the above to minimize lost telemetry through shutdown. -[The documentation](https://godoc.org/github.com/Microsoft/ApplicationInsights-Go/appinsights#TelemetryChannel) +[The documentation](https://godoc.org/github.com/microsoft/ApplicationInsights-Go/appinsights#TelemetryChannel) explains in more detail what can lead to the cases above. ### Diagnostics diff --git a/appinsights/client.go b/appinsights/client.go index 77f9b69..d532e03 100644 --- a/appinsights/client.go +++ b/appinsights/client.go @@ -3,7 +3,7 @@ package appinsights import ( "time" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) // Application Insights telemetry client provides interface to track telemetry diff --git a/appinsights/constants.go b/appinsights/constants.go index f567514..060ed59 100644 --- a/appinsights/constants.go +++ b/appinsights/constants.go @@ -2,7 +2,7 @@ package appinsights // NOTE: This file was automatically generated. -import "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" +import "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" // Type of the metric data measurement. const ( diff --git a/appinsights/contracts/contexttagkeys.go b/appinsights/contracts/contexttagkeys.go index 427f805..eaf57ab 100644 --- a/appinsights/contracts/contexttagkeys.go +++ b/appinsights/contracts/contexttagkeys.go @@ -99,7 +99,7 @@ const ( CloudRoleInstance string = "ai.cloud.roleInstance" // SDK version. See - // https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification + // https://github.com/microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification // for information. InternalSdkVersion string = "ai.internal.sdkVersion" diff --git a/appinsights/contracts/contexttags.go b/appinsights/contracts/contexttags.go index 6b97898..4263783 100644 --- a/appinsights/contracts/contexttags.go +++ b/appinsights/contracts/contexttags.go @@ -503,7 +503,7 @@ func (tags CloudContextTags) SetRoleInstance(value string) { } // SDK version. See -// https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification +// https://github.com/microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification // for information. func (tags InternalContextTags) GetSdkVersion() string { if result, ok := tags["ai.internal.sdkVersion"]; ok { @@ -514,7 +514,7 @@ func (tags InternalContextTags) GetSdkVersion() string { } // SDK version. See -// https://github.com/Microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification +// https://github.com/microsoft/ApplicationInsights-Home/blob/master/SDK-AUTHORING.md#sdk-version-specification // for information. func (tags InternalContextTags) SetSdkVersion(value string) { if value != "" { diff --git a/appinsights/contracts/package.go b/appinsights/contracts/package.go index 02d0edd..ac96d6d 100644 --- a/appinsights/contracts/package.go +++ b/appinsights/contracts/package.go @@ -1,4 +1,4 @@ // Data contract definitions for telemetry submitted to Application Insights. // This is generated from the schemas found at -// https://github.com/Microsoft/ApplicationInsights-Home/tree/master/EndpointSpecs/Schemas/Bond +// https://github.com/microsoft/ApplicationInsights-Home/tree/master/EndpointSpecs/Schemas/Bond package contracts diff --git a/appinsights/exception.go b/appinsights/exception.go index 34295eb..c440797 100644 --- a/appinsights/exception.go +++ b/appinsights/exception.go @@ -6,7 +6,7 @@ import ( "runtime" "strings" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) // Exception telemetry items represent a handled or unhandled exceptions that diff --git a/appinsights/exception_test.go b/appinsights/exception_test.go index 06a442c..c42b91d 100644 --- a/appinsights/exception_test.go +++ b/appinsights/exception_test.go @@ -5,7 +5,7 @@ import ( "strings" "testing" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) type myStringer struct{} diff --git a/appinsights/inmemorychannel.go b/appinsights/inmemorychannel.go index 4eb57d2..a309bed 100644 --- a/appinsights/inmemorychannel.go +++ b/appinsights/inmemorychannel.go @@ -5,7 +5,7 @@ import ( "time" "code.cloudfoundry.org/clock" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) var ( diff --git a/appinsights/jsonserializer.go b/appinsights/jsonserializer.go index 5ad97b9..4706cd7 100644 --- a/appinsights/jsonserializer.go +++ b/appinsights/jsonserializer.go @@ -4,7 +4,7 @@ import ( "bytes" "encoding/json" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) type telemetryBufferItems []*contracts.Envelope diff --git a/appinsights/telemetry.go b/appinsights/telemetry.go index 03b961c..54b8878 100644 --- a/appinsights/telemetry.go +++ b/appinsights/telemetry.go @@ -7,7 +7,7 @@ import ( "strconv" "time" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) // Common interface implemented by telemetry data contracts diff --git a/appinsights/telemetry_test.go b/appinsights/telemetry_test.go index 92cd9be..ba66508 100644 --- a/appinsights/telemetry_test.go +++ b/appinsights/telemetry_test.go @@ -6,7 +6,7 @@ import ( "testing" "time" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) const float_precision = 1e-4 diff --git a/appinsights/telemetrychannel.go b/appinsights/telemetrychannel.go index 4e0b41f..c539d4e 100644 --- a/appinsights/telemetrychannel.go +++ b/appinsights/telemetrychannel.go @@ -1,7 +1,7 @@ package appinsights import ( - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" "time" ) diff --git a/appinsights/telemetrycontext.go b/appinsights/telemetrycontext.go index 887894f..f54e36d 100644 --- a/appinsights/telemetrycontext.go +++ b/appinsights/telemetrycontext.go @@ -3,7 +3,7 @@ package appinsights import ( "strings" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) // Encapsulates contextual data common to all telemetry submitted through a diff --git a/appinsights/telemetrycontext_test.go b/appinsights/telemetrycontext_test.go index 9ed24fc..ada1a2e 100644 --- a/appinsights/telemetrycontext_test.go +++ b/appinsights/telemetrycontext_test.go @@ -5,7 +5,7 @@ import ( "testing" "time" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) func TestDefaultTags(t *testing.T) { diff --git a/appinsights/transmitter_test.go b/appinsights/transmitter_test.go index 3919147..fffe7f9 100644 --- a/appinsights/transmitter_test.go +++ b/appinsights/transmitter_test.go @@ -11,7 +11,7 @@ import ( "testing" "time" - "github.com/Microsoft/ApplicationInsights-Go/appinsights/contracts" + "github.com/microsoft/ApplicationInsights-Go/appinsights/contracts" ) type testServer struct { diff --git a/generateschema.ps1 b/generateschema.ps1 index 1263d95..0300a16 100644 --- a/generateschema.ps1 +++ b/generateschema.ps1 @@ -19,7 +19,7 @@ The full path to BondSchemaGenerator.exe The path to the directory that contains all of the input .bond files. -.LINK https://github.com/Microsoft/ApplicationInsights-Home +.LINK https://github.com/microsoft/ApplicationInsights-Home #> @@ -75,7 +75,7 @@ try { # Check locally. if (-not (Test-Path .\ApplicationInsights-Home -PathType Container)) { # Clone into it! - git clone https://github.com/Microsoft/ApplicationInsights-Home.git + git clone https://github.com/microsoft/ApplicationInsights-Home.git } }