NodeMetric.DefaultNodeMetrics and SessionMetric.DefaultSessionMetrics contain null values

Description

Initializing NodeMetric.AllNodeMetrics, NodeMetric.DefaultNodeMetrics, SessionMetric.AllSessionMetrics and SessionMetric.DefaultSessionMetrics in a static constructor fixes this.

Apparently NodeMetric.AllNodeMetrics was being initialized before the static properties of the inner classes (Counter, etc.) which caused it to contain several null references. Since the static constructor is invoked after static field and property initializers, it seems to do the trick.

I could only reproduce this when running the metrics integration tests against .NET Framework 4.6.1 on my local machine and they used to pass before. I recently switched to Visual Studio 2019 and installed .NET Core 3.1 SDK so maybe that changed something... On AppVeyor they have always passed and still do.

Environment

None

Assignee

Unassigned

Reporter

Joao Reis

Labels

None

Reproduced in

3.13.0

PM Priority

None

Fix versions

External issue ID

None

Doc Impact

None

Reviewer

None

Pull Request

None

Epic Link

None

Sprint

Pull Requests

None

Size

None

Priority

Major
Configure