-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use autogenerated schemas #228
Conversation
…ed schema classes
# Conflicts: # AutoCollection/ClientRequestParser.ts
data.baseData.properties[name] = this.commonProperties[name]; | ||
data: Contracts.Data<Contracts.Domain>, | ||
tagOverrides?: { [key: string]: string; }): Contracts.Envelope { | ||
if (Contracts.domainSupportsProperties(data.baseData)) { // Do instanceof check. TS will automatically cast and allow the properties property |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is slightly different logic, but I think it is more correct (plus type safe!). The difference is the previous logic would dump a default properties property on any supplied baseData. While all of our data types support this key, it is not on the base Domain class, so new ones may intentionally not have it. This will only supply the properties object if the type allows for it (or one already exists). This is done by trying to cast against the new ISupportProperties
interface. This is similar to the approach used in .NET
@@ -88,7 +88,6 @@ class ServerRequestParser extends RequestParser { | |||
newTags[ServerRequestParser.keys.locationIp] = tags[ServerRequestParser.keys.locationIp] || this._getIp(); | |||
newTags[ServerRequestParser.keys.sessionId] = tags[ServerRequestParser.keys.sessionId] || this._getId("ai_session"); | |||
newTags[ServerRequestParser.keys.userId] = tags[ServerRequestParser.keys.userId] || this._getId("ai_user"); | |||
newTags[ServerRequestParser.keys.userAgent] = tags[ServerRequestParser.keys.userAgent] || this.userAgent; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This field was dropped from the schema - so its logic is removed here accordingly
AutoCollection/Performance.ts
Outdated
@@ -208,10 +163,6 @@ class AutoCollectPerformance { | |||
this._client.trackMetric(combinedName + "nice", totalNice / combinedTotal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These metric names have to be verified for correctness as the legacy perfcounters are removed with these changes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Had offline discussion. Will keep the clean trackMetric names and ensure compatibility is kept on backend for legacy name conversion
package.json
Outdated
@@ -27,6 +27,10 @@ | |||
"email": "kszostak@microsoft.com" | |||
}, | |||
{ | |||
"name": "osrosado", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
let's replace individual names to the AppInsightsSDK account
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. What are your thoughts on aidevsupport@microsoft? I've left it for now, but we can remove it in favor of only appinsightssdk
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks, looks good
@@ -626,7 +626,7 @@ describe("Library/Client", () => { | |||
client1.commonProperties = commonproperties; | |||
client1.config.samplingPercentage = 99; | |||
mockData.baseData.properties = JSON.parse(JSON.stringify(properties)); | |||
var env = client1.getEnvelope(mockData); | |||
var env = <any>client1.getEnvelope(mockData); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need <any>, isn't sample rate specified on Contracts.Envelope?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IIRC it's not casted because of sample rate, but the basedata assertions. The base type in our schema doesn't have the properties object.
AutoCollection/Performance.ts
Outdated
// todo: remove this legacy counter once the UI updates (~june 2015) | ||
this._trackLegacyPerformance(PerfCounterType.ProcessorTime, totalUser / combinedTotal); | ||
this._trackLegacyPerformance(PerfCounterType.PercentProcessorTime, (combinedTotal - totalIdle) / combinedTotal); | ||
this._client.trackMetric("\\Processor(_Total)\\% Processor Time", (combinedTotal - totalIdle) / combinedTotal); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Following more offline discussions, common perf counters with .NET SDKs will be reported using the metric names they currently use until a new set is decided. There should be no user impact, as these are converted into appropriate values in the performanceCounter Analytics table by the backend
* Add build script command * Adds schema and typescript files to npmignore * Add tagOverrides and contextObjects (#210) * Add tagOverrides and contextObjects Also updated documentation. Yes, it's 1 commit. Yes, I'm a terrible person for doing that. * Add contextObject + formatting * Fix CORS error when using library with browserify Fixes an obscure problem when trying to use the ApplicationInsights node.js library with a browserify application. * Add missing docs (#218) * Update cross component dependency type (#219) * migrate from typings to @types (#221) * Add sampling support (#217) * Add sampling support * Fix test failure * Update readme * Fix race condition in readme example * Fix build error from typings changes * update package install and build scripts (#224) * update package install and build scripts * Adds a prepare script to replace the prepublish script for `npm install` in npm@5+. * Built artifacts from tsc are aggregated and stored in ./out for easier workspace management. * New test case which isn't transpiled by tsc to test some scenarios. Includes a test for loading the transpiled module. PR-URL: Reviewed-By: Reviewed-By: * fixup! update package install and build scripts * edits to comments in applicationinsights.ts (#223) * edits to comments * fixup! edits to comments * Use autogenerated schemas (#228) * Update BOND schema, update generated typescript with new comment generation * Update autogenerated schemas. Migrate project to only use autogenerated schema classes * Fix build errors * Address PR feedback * Add missing metric * Change metric names to be in line with .NET SDK for common metrics * Fix broken percentage units in performance counters * pick up generated Declaration submodule (#232) * Set the host app version to the context tags. #183 (#233) * Sets version to the context tags * No Readme changes * Correct unit test * Update Client.ts Typo on the comment solved and switched the method name from setVersion to overrideApplicationVersion. * Update Client.tests.ts I apologize for the inconvenience, unit test corrected. * Updating how cross-application correlations are tracked (#231) * Updating how cross-application correlations are tracked Instead of using a hash of the instrumentation key we now use the appId, matching the .NET sdk. We also use different headers to match the .NET sdk. * Updating to only issue appId requests once per ikey * Exposing profileQueryEndpoint property Allows for the appId query target to be configured separately to the telemetry endpoint. It may be specified either by the APPINSIGHTS_PROFILE_QUERY_ENDPOINT environment variable, or explicitly via client.config.profileQueryEndpoint. Note that it must be set synchronously with the creation of the Config otherwise the value will not be used. * Allowing appId lookups to be cancelled if a new endpoint is specified * Adding operationId to outbound HTTP headers * Provide access to contracts (#234) * Provide access to contracts * Test for access to contracts * Change access to Contracts from Client.ts to applicationinsights.ts * Fix baseTypes (#236) * update README * address Alex's feedback * Fixing CorrelationId There was a typo which lead to the `correlationIdPrefix` being null. * Adding diagnostic-channel (#235) * Adding diagnostic-channel By using diagnostic-channel and diagnostic-channel-publishers, we can support context tracking through third-party libraries as well as getting additional telemetry for those dependencies. * Fixing cyclical reference and supporting multiple AI clients in diagnostic-channel subscribers * Updating readme with diagnostic-channel information * Update Readme (#238) * Enable automatic correlation by default (#239) * Include typescript definitions in NPM package (#240) * Update package.json to 0.20 (#241)
This PR will:
require
Addresses issues:
#122
#162
#192