Skip to content
This repository has been archived by the owner on Jul 5, 2020. It is now read-only.

Adds new EventCounterCollectorModule #1224

Merged
merged 14 commits into from
Jul 3, 2019
Merged

Conversation

cijothomas
Copy link
Contributor

Fix Issue #1222

Adds new Nuget package, new ITelemetryModule for collecting EventCounters.

I am working on adding Unit Tests, please review product code.

For significant contributions please make sure you have completed the following items:

  • Changes in public surface reviewed

  • Design discussion issue #

  • CHANGELOG.md updated with one line description of the fix, and a link to the original issue.

  • The PR will trigger build, unit tests, and functional tests automatically. If your PR was submitted from fork - mention one of committers to initiate the build for you.
    If you want to to re-run the build/tests, the easiest way is to simply Close and Re-Open this same PR. (Just click 'close pull request' followed by 'open pull request' buttons at the bottom of the PR)

  • Please follow [these] (https://github.com/Microsoft/ApplicationInsights-dotnet-server/blob/develop/CONTRIBUTING.md) instructions to build and test locally.

@cijothomas cijothomas closed this Jun 24, 2019
@cijothomas cijothomas reopened this Jun 24, 2019
@TimothyMothra TimothyMothra added this to the 2.11 milestone Jun 28, 2019
var counterName = payload.Value.ToString();
if (this.countersToCollect[eventSourceName].Contains(counterName))
{
metricTelemetry.Name = string.Format(CultureInfo.InvariantCulture, "{0}|{1}", eventSourceName, counterName);
Copy link
Member

Choose a reason for hiding this comment

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

it is cheaper to concatenate strings than call string.format. We are on the hot path here

http://geekswithblogs.net/BlackRabbitCoder/archive/2010/05/10/c-string-compares-and-concatenations.aspx

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure what is the recommendation here..https://stackoverflow.com/questions/296978/when-is-it-better-to-use-string-format-vs-string-concatenation
I am unable to find concrete recommendation about one vs other.

Copy link
Member

@lmolkova lmolkova left a comment

Choose a reason for hiding this comment

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

Left some comments, overall LGTM

var counterName = payload.Value.ToString();
if (this.countersToCollect[eventSourceName].Contains(counterName))
{
metricTelemetry.Name = eventSourceName + "|" + counterName;
Copy link

Choose a reason for hiding this comment

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

Is this what appears to the users? If so you should use the DisplayName property in the payload instead. Our guidance is that Name is the property that should be used internally within code, command-line parameters, etc. whereas DisplayName property is the one that gets shown on APM/dashboards/etc.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes! good point. I somehow missed this. Will do a followup PR to address this and actually allow users to specific 'reportAs' as well, so users can decide what the name should appear.

@sywhang
Copy link

sywhang commented Jul 3, 2019

Other than the two comments I made above I think things look fine (from a quick glance) - Please feel free to tag me on any follow-up PRs regarding counters/EventListener and I'd be happy to help answer any questions :-)

@cijothomas cijothomas merged commit e5a0edb into develop Jul 3, 2019
@cijothomas cijothomas mentioned this pull request Jul 8, 2019
5 tasks
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants