Skip to content
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

[Shim] Add Auto-Collection Methods, TelemetryClient, and Config #1175

Merged
merged 54 commits into from
Aug 14, 2023

Conversation

JacksonWeber
Copy link
Contributor

@JacksonWeber JacksonWeber commented Aug 2, 2023

  • Add auto-collection methods
  • Add global applicationinsights to handle shim import compatibility
  • Fix initialization of setup() and start() so customers can use client.config before running start()
  • Implement config properties to set corresponding values on the Azure Monitor Client
  • Add tests for the client.config

@JacksonWeber JacksonWeber changed the title [Draft][Shim] Add Auto-Collection Methods [Draft][Shim] Add Auto-Collection Methods, TelemetryClient, and Config Aug 4, 2023
@JacksonWeber JacksonWeber changed the title [Draft][Shim] Add Auto-Collection Methods, TelemetryClient, and Config [Shim] Add Auto-Collection Methods, TelemetryClient, and Config Aug 9, 2023
private _options: ApplicationInsightsOptions;
private _client: AzureMonitorOpenTelemetryClient;
private _console: AutoCollectConsole;
private _exceptions: AutoCollectExceptions;
private _idGenerator: IdGenerator;
public context: Context;
public commonProperties: { [key: string]: string }; // TODO: Add setter so Resources are updated
public config: IConfig;

/**
* Constructs a new client of the client
* @param setupString the Connection String or Instrumentation Key to use (read from environment variable if not specified)
*/
constructor(input?: string | ApplicationInsightsOptions) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove ApplicationInsightsOptions parameter from here and leave same structure as old Application Insights

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That will break some things like the functional tests and the configuration example in the distro's README. Are we planning to release the shim after some changes to the distro's user configuration?

}

public trackNodeHttpRequest(telemetry: Contracts.NodeHttpRequestTelemetry) {
Logger.getInstance().warn("trackNodeHttpRequest is not implemented and is a no-op.");
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are these not supported? what exactly these were doing before?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were some helper functions that called methods (trackRequestSync and trackRequest) inside of the AutoCollectHttpRequests class. Given that OpenTelemetry tracks requests synchronously by default I figured it'd be less confusing to just say these methods weren't supported and have users unify on calling the single trackRequest method.

I think it'd also be fair to implement them all calling the TelemetryClient.trackRequest() or trackDependency methods and just note that these will all be synchronous.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll update the message here to make it more explicit to users the expected alternative method to call.

Copy link
Member

@hectorhdzg hectorhdzg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@JacksonWeber JacksonWeber merged commit fac6651 into microsoft:beta Aug 14, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants