-
Notifications
You must be signed in to change notification settings - Fork 13
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
feat: enhancements to OpenTelemetry support #149
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #149 +/- ##
==========================================
- Coverage 91.22% 87.94% -3.28%
==========================================
Files 19 23 +4
Lines 1003 1120 +117
Branches 133 171 +38
==========================================
+ Hits 915 985 +70
- Misses 82 83 +1
- Partials 6 52 +46 ☔ View full report in Codecov by Sentry. |
3fe9b36
to
bd78c29
Compare
Quick thoughts on this - My major concern is the configuration as that would be a breaking change to change later. If we can move the attrib and metric names to enums and make the configuration something like here https://github.com/openfga/dotnet-sdk/blob/main/OpenTelemetry.md, that would be great Having the constructor as it is currently, take a set of true/false is problematic, b/c it's not easy for the user to tell what they are configuring and we could easily do a breaking change by changing the order without the user being aware. Validation for the config would be great too to help users avoid typos For the record, here's what the config looks like in .NET TelemetryConfig telemetryConfig = new () {
Metrics = new Dictionary<string, MetricConfig> {
[TelemetryMeters.TokenExchangeCount] = new () {
Attributes = new HashSet<string> {
TelemetryAttribute.HttpScheme,
TelemetryAttribute.HttpMethod,
TelemetryAttribute.HttpHost,
TelemetryAttribute.HttpStatus,
TelemetryAttribute.HttpUserAgent,
TelemetryAttribute.RequestMethod,
TelemetryAttribute.RequestClientId,
TelemetryAttribute.RequestStoreId,
TelemetryAttribute.RequestModelId,
TelemetryAttribute.RequestRetryCount,
TelemetryAttribute.ResponseModelId
}
},
[TelemetryMeters.QueryDuration] = new () {
Attributes = new HashSet<string> {
TelemetryAttribute.HttpStatus,
TelemetryAttribute.HttpUserAgent,
TelemetryAttribute.RequestMethod,
TelemetryAttribute.RequestClientId,
TelemetryAttribute.RequestStoreId,
TelemetryAttribute.RequestModelId,
TelemetryAttribute.RequestRetryCount,
}
},
[TelemetryMeters.QueryDuration] = new () {
Attributes = new HashSet<string> {
TelemetryAttribute.HttpStatus,
TelemetryAttribute.HttpUserAgent,
TelemetryAttribute.RequestMethod,
TelemetryAttribute.RequestClientId,
TelemetryAttribute.RequestStoreId,
TelemetryAttribute.RequestModelId,
TelemetryAttribute.RequestRetryCount,
}
},
}
};
var configuration = new ClientConfiguration() {
ApiUrl = Environment.GetEnvironmentVariable("FGA_API_URL"),
StoreId = Environment.GetEnvironmentVariable("FGA_STORE_ID"),
AuthorizationModelId = Environment.GetEnvironmentVariable("FGA_MODEL_ID"),
// Credentials = ... // If needed
Telemetry = telemetryConfig
}; Sidenote: would be good to update up the docs and example too |
1d8efd9
to
1f7a00e
Compare
…ig.telemetryConfig)
423222b
to
bbb7976
Compare
Description
This PR introduces enhancements to our OpenTelemetry metrics reporting support, migrating enhancements made to the Java, Go, and Python SDKs:
TelemetryConfiguration
andTelemetryMetricConfiguration
classes.Configuration
has been updated to support the acceptance of aTelemetryConfiguration
instance for configuring metrics reporting at runtime.References
Review Checklist
main