You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
With/After #25880 and #33633, it would be nice to have option for more granularity - i.e. metrics per "database" (connection string, some user provided name, DbDataSource, etc.).
The text was updated successfully, but these errors were encountered:
From our design discussion on this... What's needed is a metric "dimension" for which database is being accessed, so that accesses to e.g. the "customers" and "products" databases can be tracked separately (this is well-supported by the new metrics API).
The main problem here is what value that dimension would have... The only natural and universal identifier currently available is the connection string, which isn't a great value to use, but is probably OK. We should then expose some sort of hook for the user to configure this info in the context options config (e.g. UseSqlServer(..., o => o.UseMetricsIdentifier("Customers"))). We could also consider a provider hook so that the provider can take care of this; for example, NpgsqlDataSource has the concept of a "name" (for exactly the same purpose, metrics reporting at the ADO.NET level); a hook would allow EFCore.PG to extract this and use it for the EF metrics as well.
This will likely be incompatible with multi-tenant and related scenarios where the same service provider is being used with different connection string databases (since the metrics identifier would presumably be a singleton). This is yet another example of the difficulties created by OnConfiguring and varying configuration inside the same provider; users would be able to simply have different factories/service providers for their different databases to properly deal with this.
roji
changed the title
Add more granularity for OpenTelemetry metrics
Add more granularity for OpenTelemetry metrics (per-database metrics)
May 22, 2024
With/After #25880 and #33633, it would be nice to have option for more granularity - i.e. metrics per "database" (connection string, some user provided name,
DbDataSource
, etc.).The text was updated successfully, but these errors were encountered: