Skip to content

Latest commit

 

History

History
41 lines (22 loc) · 2.78 KB

schema-generation.md

File metadata and controls

41 lines (22 loc) · 2.78 KB

Application Insights schema

Application Insights schemas for telemetry data located in Schemas folder.

Schema and code generation

Internal endpoint schema

The source of truth for the Application Insights schema is defined in internal endpoint repository. This schema has all public fields as well as planned new fields and deprecated old fields that can be accepted by the endpoint.

Public schema is generated by removing all fields and data types marked as deprecated or internal using the BondSchemaGenerator.exe tool. See the script in Tools folder.

Public schemas

Public schema is located in Application Insights home repository. Every SDK generating code from schema keeps it's own copy of schemas. Local copy is stored to ensure consistency between the code and schema this code was generated from. See dotnet repository for example. Script in corresponding repository copy schemas from home repo and generate code.

Code generation

One of requirements for Application Insights SDK is to minimize the number of dependencies. SDKs do not take dependency on Microsoft Bond packages. Custom tool BondSchemaGenerator.exe is used to generate code.

Tools has different level of support for different languages. For C#, tool generate only data structures.

Another requirement for SDK was minimization of public surface APIs changes. Thus for C# public surface API is manually written code. All generated data classes are part of internal implementation.

Process of code generation

Internal only:

  1. Update schema in internal endpoint repository.
  2. Generate endpoint code by running scripts in internal endpoint repository. Send PR and ensure schema update is deployed to production.

Public schemas:

  1. In home repository. Run generateSchema.ps1. Send PR and ensure it is merged to master.

For .NET:

  1. In dotnet repository run generateSchema.ps1. Send PR and ensure it is merged to master.
  2. Update public surface API to utilize new fields or expose other schema changes. Follow the standard contribution process since any change in public API needs to be reviewed.
  3. Update schemas and code in dotnet-server repository generateSchema.ps1