-
Notifications
You must be signed in to change notification settings - Fork 109
Feat: Add Metrics Tracer and Metrics Tracer Factory #2311
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
base: main
Are you sure you want to change the base?
Conversation
Airlock failures are on: https://www.npmjs.com/package/@opentelemetry/resource-detector-gcp/v/0.33.0?activeTab=versions |
}; | ||
} | ||
|
||
public static getInstance(enabled: boolean, gfeEnabled = false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should the service metrics and GFE metrics be enabled or disabled by default? And what should the env vars be?
In Java I see:
SPANNER_DISABLE_BUILTIN_METRICS
SPANNER_DISABLE_DIRECT_ACCESS_GRPC_BUILTIN_METRICS
Which sounds like they should be enabled by default and the env vars can be set to turn them off.
const clientName = `${Constants.SPANNER_METER_NAME}/${version}`; | ||
const clientUid = MetricsTracerFactory._generateClientUId(); | ||
const clientHash = MetricsTracerFactory._generateClientHash(clientUid); | ||
const location = MetricsTracerFactory._detectClientLocation(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that these metric attributes can be determined at construction time, but the projectid, instanceid, and databaseid are not available during client construction (when this factory will be created), which is why they are not set here. I copied equivalent methods to create the clientuid and clienthash, and detect location, from other clients.
Description
This PR introduces a metrics factory to the codebase. It's a direct follow-up to the previously merged metrics exporter (see PR #2272). This factory is responsible for creating and managing the specific service metrics that will be instrumented throughout the code in subsequent changes.
Impact
This change introduces new components but has no immediate impact as the factory is not called at this time.
Testing
Unit tests have been added to verify the correct functionality of the metrics factory and its interaction with the exporter. Additionally, manual verification confirmed that the factory and exporter correctly create and are capable of emitting metrics to Google Cloud Platform (GCP).
This PR introduces no breaking changes.
Additional Information
Future metrics work will involve:
Checklist