Skip to content

Commit

Permalink
[Main][Task]27156360: Add json config cdn details to tool folder (#2299)
Browse files Browse the repository at this point in the history
* add cfgsync config

* update

* update

* update
  • Loading branch information
Karlie-777 committed Mar 19, 2024
1 parent 0808a05 commit 0f8f442
Show file tree
Hide file tree
Showing 7 changed files with 187 additions and 114 deletions.
140 changes: 70 additions & 70 deletions common/config/rush/npm-shrinkwrap.json

Large diffs are not rendered by default.

75 changes: 75 additions & 0 deletions docs/WebConfig.md
@@ -0,0 +1,75 @@
# Microsoft Application Insights JavaScript SDK - Web Config for CfgSync Plugin

Define ThrottleMgrCfg Configurations and feature opt-in status details.

## Change History

### Version

1.0.0 (March, 2024)

CDN details

| Name | Description | Details
|---------|------|----------------
| enabled | General on/off | `true` (on)
| featureOptIn | opt-in feature list | iKeyUsage (*inital opt-in*)
| featureOptIn.iKeyUsage.mode | feature-iKeyUsage enable/disable status | `3` (enable/opt-in)
| featureOptIn.iKeyUsage.onCfg | override values of the following cdn `config` when feature-iKeyUsage is enabled | <sub>DefaultThrottleMsgKey</sub></br>throttleMgrCfg.109.enabled: `false`</br> <sub>InstrumentationKeyDeprecation</sub></br> throttleMgrCfg.106.enabled: `true`
| featureOptIn.iKeyUsage.offCfg | override values of the following cdn `config` when feature-iKeyUsage is disabled | <sub>DefaultThrottleMsgKey</sub></br>throttleMgrCfg.109.enabled: `false`</br> <sub>InstrumentationKeyDeprecation</sub></br> throttleMgrCfg.106.enabled: `false`
| config | override values for user's core config | throttleMgrCfg
| config.throttleMgrCfg | override values for user's throttleMgrCfg under core config | <sub>InstrumentationKeyDeprecation</sub></br> throttleMgrCfg.106:</br>{ `"enabled": true`, *// will send ikey InstrumentationKey Deprecation message*</br>`"limit": { "samplingRate": 1, "maxSendNumber": 1}`, *// sampling rate: 0.0001%, and will send max one message per time* </br>`"interval": {"monthInterval": 2,"daysOfMonth": [1]}`} *// message will be sent on the first day every 2 months*,</br><sub>DefaultThrottleMsgKey</sub></br>throttleMgrCfg.109:</br>{ `"enabled": false`, *// will not send default ikey message*</br> ... *// all other settings are same with the InstrumentationKeyDeprecation settings*}</br>

#### Note

This change will begin InstrumentationKeyDeprecation message throttling. If InstrumentationKey is used instead of ConnectionString for appInsights SDK initialization, logs with InstrumentationKeyDeprecation(106) message id will be sent.

## Basic Usage

### Change Feature Opt-in Status

Under your config, define opt-in details in `featureOptIn`

```js

//to define iKeyUsage opt-in details
{
connectionString: "YOUR_CONNECTION_STRING",
...
featureOptIn: {["iKeyUsage"]: {
mode: FeatureOptInMode.disable, // set feature-iKeyUsage opt-in status to disable
blockCdnCfg: false, //define if should block any changes from web config cdn
} as IFeatureOptInDetails
}
}

```

## Contributing

This project welcomes contributions and suggestions. Most contributions require you to
agree to a Contributor License Agreement (CLA) declaring that you have the right to,
and actually do, grant us the rights to use your contribution. For details, visit
https://cla.microsoft.com.

When you submit a pull request, a CLA-bot will automatically determine whether you need
to provide a CLA and decorate the PR appropriately (e.g., label, comment). Simply follow the
instructions provided by the bot. You will only need to do this once across all repositories using our CLA.

This project has adopted the [Microsoft Open Source Code of Conduct](https://opensource.microsoft.com/codeofconduct/).
For more information see the [Code of Conduct FAQ](https://opensource.microsoft.com/codeofconduct/faq/)
or contact [opencode@microsoft.com](mailto:opencode@microsoft.com) with any additional questions or comments.

## Data Collection

As this SDK is designed to enable applications to perform data collection which is sent to the Microsoft collection endpoints the following is required to identify our privacy statement.

The software may collect information about you and your use of the software and send it to Microsoft. Microsoft may use this information to provide services and improve our products and services. You may turn off the telemetry as described in the repository. There are also some features in the software that may enable you and Microsoft to collect data from users of your applications. If you use these features, you must comply with applicable law, including providing appropriate notices to users of your applications together with a copy of Microsoft's privacy statement. Our privacy statement is located at https://go.microsoft.com/fwlink/?LinkID=824704. You can learn more about data collection and use in the help documentation and our privacy statement. Your use of the software operates as your consent to these practices.

## Trademarks

This project may contain trademarks or logos for projects, products, or services. Authorized use of Microsoft trademarks or logos is subject to and must follow [Microsoft's Trademark & Brand Guidelines](https://www.microsoft.com/en-us/legal/intellectualproperty/trademarks/usage/general). Use of Microsoft trademarks or logos in modified versions of this project must not cause confusion or imply Microsoft sponsorship. Any use of third-party trademarks or logos are subject to those third-party's policies.

## License

[MIT](LICENSE)
4 changes: 2 additions & 2 deletions gruntfile.js
Expand Up @@ -795,8 +795,8 @@ module.exports = function (grunt) {
},
config: {
files: [
{ src: "./tools/config/config.json", dest: `./tools/config/browser/ai.config${configVer}.cfg.json` },
{ src: "./tools/config/config.json", dest: `./tools/config/browser/ai.config${configMajorVer}.cfg.json` }
{ src: "./tools/config/config.json", dest: `./tools/config/browser/es5/ai.config${configVer}.cfg.json` },
{ src: "./tools/config/config.json", dest: `./tools/config/browser/es5/ai.config${configMajorVer}.cfg.json` }
]
}
}
Expand Down
72 changes: 33 additions & 39 deletions tools/config/config.json
@@ -1,49 +1,43 @@
{
"name":"Application Insights Config",
"description":" Application Insights JavaScript SDK - Web Config",
"copyright": "(c) Microsoft and contributors. All rights reserved.",
"author": "Microsoft Application Insights Team",
"throttleConfig": {
"default": {
"msgKey": 0,
"limit": {
"sendPercentage": 0,
"maxSendNumber": 0
"version": "1.0.0",
"enabled": true,
"featureOptIn": {
"iKeyUsage": {
"mode": 3,
"onCfg": {
"throttleMgrCfg.109.enabled": false,
"throttleMgrCfg.106.enabled": true
},
"interval": {
"monthInterval": 100,
"dayInterval": 100,
"maxTimesPerMonth": 0
"offCfg": {
"throttleMgrCfg.109.enabled": false,
"throttleMgrCfg.106.enabled": false
}
},
"config": {
"ikeyDeprecation": {
"msgKey": 1,
"limit": {
"sendPercentage": 1,
"maxSendNumber": 10
}
},
"config": {
"throttleMgrCfg": {
"109": {
"enabled": false,
"limit": {
"samplingRate": 1,
"maxSendNumber": 1
},
"interval": {
"monthInterval": 3,
"dayInterval": 28,
"maxTimesPerMonth": 1
"monthInterval": 2,
"daysOfMonth": [1]
}
},
"cdnDeprecation": {
"ikeyDeprecation": {
"msgKey": 2,
"limit": {
"sendPercentage": 1,
"maxSendNumber": 10
},
"interval": {
"monthInterval": 3,
"dayInterval": 28,
"maxTimesPerMonth": 1
}
},
"106": {
"enabled": true,
"limit": {
"samplingRate": 1,
"maxSendNumber": 1
},
"interval": {
"monthInterval": 2,
"daysOfMonth": [1]
}
}
}
}
}

}
4 changes: 2 additions & 2 deletions tools/config/package.json
@@ -1,7 +1,7 @@
{
"name": "applicationinsights-web-config",
"description": " Application Insights JavaScript SDK - Web Config",
"version": "0.1.1",
"description": "Application Insights JavaScript SDK - Web Config for CfgSync Plugin",
"version": "1.0.0",
"copyright": "(c) Microsoft and contributors. All rights reserved.",
"author": "Microsoft Application Insights Team",
"repository": {
Expand Down
4 changes: 4 additions & 0 deletions tools/release-tools/package_groups.json
Expand Up @@ -44,6 +44,10 @@
"cfgSync": [
"./extensions/applicationinsights-cfgsync-js"
],
// Config for throttleMgr and feature Opt-in
"webConfig": [
"./tools/config"
],
// Rollup packages
"rollup-es": [
"./tools/rollup-es5"
Expand Down
2 changes: 1 addition & 1 deletion version.json
Expand Up @@ -58,7 +58,7 @@
},
"applicationinsights-web-config": {
"package": "tools/config/package.json",
"release": "0.1.1"
"release": "1.0.0"
},
"@microsoft/applicationinsights-example-aisku": {
"package": "examples/AISKU/package.json",
Expand Down

0 comments on commit 0f8f442

Please sign in to comment.