Refactor track* API
See original GitHub issueBefore we ship stable SDK I would like to refactor track API:
- To make track* functions more consistent between themselves.
- To allow specifying timestamp
- To address some reported bugs such as inability to specify result code for dependencies #286 and not being able to track requests without request object #148
- To make names consistent with property names in Portal and Analytics
- To make API consistent with .NET API
- To reduce the number of positional argument to the ones required, while keeping the others in TrackOptions bag.
This is the proposal:
interface TrackOptions
{
timestamp?: Date;
properties?: { [key: string]: string; }
measurements?:{ [key: string]: number; }
contextObjects?: {[name: string]: any;}
tagOverrides?: { [key: string]: string; }
}
void trackDependency(
dependencyTypeName: string,
target: string,
dependencyName: string,
data: string,
duration: number,
resultCode: string
success: bool
trackOptions: TrackOptions);
void trackEvent(
eventName: string,
trackOptions: TrackOptions);
void trackTrace(
message: string,
severityLevel: SeverityLevel
trackOptions: TrackOptions);
void trackMetric(
metricName: string,
metricValue: number
trackOptions: TrackOptions);
void trackException(
exception: Error,
trackOptions: TrackOptions);
void trackRequest(
name: string,
duration: number,
resultCode: string
success: bool
trackOptions: TrackOptions);
Issue Analytics
- State:
- Created 6 years ago
- Comments:14 (12 by maintainers)
Top Results From Across the Web
Refactoring API Code - API - INTERMEDIATE - Skillsoft
In this course, you'll learn about the need for refactoring, best practices, and benefits of refactoring code. You'll then examine technical debt and...
Read more >Is there any Eclipse refactoring API that I can call ...
I know that from inside the Eclipse IDE I can refactor my classes. But is there any API that I can use in...
Read more >Refactoring Towards Expressive REST APIs: Let Your Code ...
One of the main advantages of RESTful APIs is discoverability—clients can know what resources are available to them based on hypermedia links ...
Read more >Refactoring source code in Visual Studio Code
Visual Studio Code supports refactoring operations (refactorings) such as Extract Method and Extract Variable to improve your code base from within your editor....
Read more >How to refactor code when capturing calls made to an API ...
The method that takes an URI, breaks it down, creates a SQL query, and returns the rows as a PreparedStatement, used to be...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Discussed with Sergey and decided to do 2 changes:
@OsvaldoRosado, I agree with this approach, this is how I’m doing it: https://github.com/Microsoft/ApplicationInsights-node.js/blob/albulank/trapi/Library/NodeClient.ts