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

Adding Attach and Feature Statbeats #799

Merged
merged 7 commits into from
Jul 28, 2021
Merged

Conversation

hectorhdzg
Copy link
Member

No description provided.

@hectorhdzg hectorhdzg requested a review from lzchen July 26, 2021 22:35
if (process.env.WEBSITE_SITE_NAME) { // Web apps
this._resourceProvider = Constants.StatsbeatResourceProvider.appsvc;
this._resourceIdentifier = process.env.WEBSITE_SITE_NAME;
Copy link

Choose a reason for hiding this comment

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

@heyams Current specs says WEBSITE_SITE_NAME/WEBSITE_HOME_STAMPNAME for rpid. Does this mean the literal string (with the slash concatenating the two), or choose WEBSITE_SITE_NAME if available, otherwise WEBSITE_HOME_STAMPNAME?

Copy link

Choose a reason for hiding this comment

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

I expect WEBSITE_SITE_NAME/WEBSITE_HOME_STAMPNAME. if stampName is empty, it will be "{WEBSITE_SITE_NAME}/". yes.

} else if (process.env.FUNCTIONS_WORKER_RUNTIME) { // Function apps
this._resourceProvider = Constants.StatsbeatResourceProvider.function;
if (process.env.WEBSITE_HOSTNAME) {
this._resourceIdentifier = process.env.WEBSITE_HOSTNAME;
}
} else if (this._config) {
Copy link

Choose a reason for hiding this comment

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

What if the application is not in any of these rps? We probably shouldn't be sending this stats at all.

Copy link

Choose a reason for hiding this comment

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

rp has a default case: "unknown". like standalone apps.. it's not an attach scenario.

Copy link

Choose a reason for hiding this comment

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

Right, so we should not be sending any of the "attach" metrics in this default case.

Copy link
Member Author

Choose a reason for hiding this comment

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

@heyams can you confirm we don't send attach Statbeat for unknown

Copy link

Choose a reason for hiding this comment

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

I would like to track unknown as well.. i.e. non-attach vs. attach. that's a good data trend to show.

Copy link

@lzchen lzchen Jul 27, 2021

Choose a reason for hiding this comment

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

What do we populate for properties then? Do we just leave empty? Does metric have same name and fields?

"language": this._language,
"version": this._sdkVersion
}
this._statbeatMetrics.push({ name: Constants.StatsbeatCounter.ATTACH, value: 1, properties: attachProperties });
Copy link

Choose a reason for hiding this comment

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

attach statsbeat is every 15 mins. feature is every 24 hours. you might want to have a separate method for attach and one for feature.

Copy link

Choose a reason for hiding this comment

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

@heyams For applications that exit before 24 hours, do we send a statsbeat telemetry upon exit?

Copy link
Member Author

Choose a reason for hiding this comment

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

@heyams Why attach is being sent every 15 minutes?, are you expecting rpId to be updated that often?

Copy link

Choose a reason for hiding this comment

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

this is the same interval as the azure metadata service.

Copy link

Choose a reason for hiding this comment

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

vm id can get changed frequently, which impacts rpId for vm. other attach scenarios is not an issue.

Copy link

Choose a reason for hiding this comment

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

@heyams For applications that exit before 24 hours, do we send a statsbeat telemetry upon exit?

it will be nice. currently java doesn't do that.

Copy link

Choose a reason for hiding this comment

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

It's not only about "nice". If applications exit, there may be cases where we never get the telemetry. We MUST flush before exit.

Copy link

Choose a reason for hiding this comment

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

@hectorhdzg probably not blocking for this pr though

Copy link
Member Author

Choose a reason for hiding this comment

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

@lzchen we flush all telemetry on exit, but we do not create telemetry on exit, we don't want to do that, that will make sense with high priority telemetry, maybe something that actually let users know that the app stopped running, but that doesn't apply with Statsbeats

Copy link

Choose a reason for hiding this comment

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

Interesting. Something to bring up at tomorrow's meeting.

AutoCollection/Statsbeat.ts Outdated Show resolved Hide resolved
Copy link

@heyams heyams left a comment

Choose a reason for hiding this comment

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

One minor constant renaming.. other than that, looks good to me.

let attachProperties = {
"os": this._os,
"rp": this._resourceProvider,
"rpid": this._resourceIdentifier,
Copy link

Choose a reason for hiding this comment

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

Curious, what will undefined serialize as? Empty string? This is for the case when rp == unknown

Copy link
Member Author

Choose a reason for hiding this comment

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

this._resourceIdentifier defaults to "unknown" so it supposed to never be undefined, are you seeing something here?
I believe undefined properties are dropped when serializing JSON, at least they are when running this in the browser
JSON.stringify({"test":undefined})
"{}"

Copy link

Choose a reason for hiding this comment

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

So on non-attach scenario, the payload would look like: {"rp": "unknown"} with no "rpid" correct?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually rpid is also included, something like this {"rp": "unknown","rpid": "unknown"}

"language": this._language,
"version": this._sdkVersion,
"attach": this._attach,
"feature": this._features,
Copy link

Choose a reason for hiding this comment

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

The "aad handling" is listed as a feature. Will stats be released as the next beta version?

Copy link

Choose a reason for hiding this comment

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

@hectorhdzg is aad handling the same as tracking aad enablement? i check your repo.. look like this is not added anywhere to the feature list. it only happens in tests.

Copy link
Member Author

Choose a reason for hiding this comment

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

We only have AAD feature in beta branch, I'm planning to update beta with latest changes in main for next release including Statsbeat implementation

Copy link

Choose a reason for hiding this comment

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

@hectorhdzg
So statsbeats will be released as the next beta package?

Copy link
Member Author

Choose a reason for hiding this comment

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

Statbeats will be part of both releases, beta and regular one

@lzchen
Copy link

lzchen commented Jul 27, 2021

Statsbeats metrics related to instrumentations have not been added yet correct? @hectorhdzg

"language": this._language,
"version": this._sdkVersion,
"attach": this._attach,
"feature": this._features,
Copy link

Choose a reason for hiding this comment

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

@heyams @hectorhdzg Do we have a comprehensive list of all the features we will be tracking for each language? It would also be good to coordinate bit representations for common features across our sdks.

Copy link

Choose a reason for hiding this comment

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

each language will have their own specific features.. tracking AAD enablement will be a common feature.. other than that, there is nothing else i can think of.

Copy link

Choose a reason for hiding this comment

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

What about local storage? Standard metrics? Pre-aggregated metrics? Live metrics? All of these are/will be features that will be supported by all sdks so we should agree on a list.

Copy link
Member Author

Choose a reason for hiding this comment

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

@lzchen having a shared list of features will make easier the data consumption here, happy to add them once we agree on them

Copy link

Choose a reason for hiding this comment

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

Statsbeat is designed only for Breeze endpoints. Live metrics is not tracked. Java hasn't implemented pre-aggregated metrics and standard metrics yet.
I am planning to create a new set of statsbeat metrics for Local Storage. As of now, AAD is the only common feature. Let's get the basic Statsbeat done first and we can add the rest as Statsbeat evolves.. A list to agree upon at this moment is premature. Please document it somewhere for future consideration. (cc @ramthi)

@hectorhdzg
Copy link
Member Author

@lzchen we send instrumentation property in all network Statsbeats, I don't believe there is an "Instrumentation" specific one.

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

3 participants