open-telemetry / semantic-conventions

Defines standards for generating consistent, accessible telemetry across a variety of domains
Apache License 2.0
256 stars 165 forks source link

Database metrics - adding conventions for database server metrics #299

Open niuxiaojuan-github opened 1 year ago

niuxiaojuan-github commented 1 year ago

Hi, We have following proposal for database server metrics, would like to hear some feedback from community.

We referenced to General Guidelines, Attribute Naming, Requirement Levels and current database metrics for connection pool, system metrics, process metric to draft this.

We attempted to extract metrics that are as generic as possible, but this is not an easy task due to the diversity of the databases, we are still working on it, and would like to get some guidance and feedback based on currently what we have.

Resource attributes

Database

Description: A database.

Attribute Key Type Description Example Requirement Level
db.system string An identifier for the database management system (DBMS) product being used. db2, damengdb Required      
db.version string The version of the database V11.5, V8 Required      
server.address string Name of the database host. db.testdb.com Recommended
server.port int database listen port 50000, 5236 Recommended      
db.name string This attribute is used to report the name of the database being accessed. For commands that switch the database, this should be set to the target database BLUDB, DAMENG Conditionally Required: If applicable.      

Instance

Description: A database instance. Conditionally Required.

Attribute Key Type Description Example Requirement Level
db.instance.name string The db instance name db2inst1, DMSERVER Conditionally Required: If applicable.
db.instance.number int The db instance number 1 Conditionally Required
db.instance.host string The hostname of the db instance db.testdb.com Conditionally Required

Common metric instruments

All metrics in db. instruments should be attached to a Database resource and therefore inherit its attributes, like db.system.

All metrics in db.instance instruments should be attached to a Instance resource and therefore inherit its attributes, like db.instance.name.

Availability

Name Description Units Instrument Type Value Type Attribute Key(s) Attribute Values
db.status Recommended. The status of the database. 1 (Active), 0 (Inactive) {status} Gauge Int state (Required) Active, Inactive  
db.instance.status Recommended. The status of the db instance. 1 (Active), 0 (Inactive) {status} Gauge Int state (Required)  Active, Inactive
db.instances.count Recommended. The total number of db instances. {instance} UpDownCounter Int    
db.instances.active.count Recommended. The total number of active db instances. {instance} UpDownCounter Int    

Throughput

Name Description Unit Instrument Type Value Type Attribute Key(s) Attribute Values
db.sessions.count Recommended. The number of database sessions. {session} UpDownCounter Int    
db.sessions.active.count Recommended. The number of active database sessions. {session} UpDownCounter Int    
db.transactions.count Recommended. The number of completed transactions. {transaction} UpDownCounter Int    
db.transactions.rate Recommended. The number of transactions per second. {transaction} Gauge Double    
db.transactions.latency Recommended. The average transaction latency. s Gauge Double    
db.sql.count Recommended. The number of SQLs {sql} UpDownCounter Int64    
db.sql.rate Recommended. The number of SQL per second. {sql} Gauge Double    
db.sql.latency Recommended. The average SQL latency. s Gauge Double    
db.io.read.rate Recommended. The physical read per second. By Gauge Double    
db.io.write.rate Recommended. The physical write per second. By Gauge Double    

Performance

Name Description Unit Instrument Type Value Type Attribute Key(s) Attribute values
db.cache.hit The cache hit ratio/percentage 1 UpDownCount Double type (cache type)
niuxiaojuan-github commented 1 year ago

Discussed on Sept 11 meeting, @jsuereth suggested creating a project proposal for a semconv working group on databases.

XiangSu-IBM commented 1 year ago

@niuxiaojuan-github Hi Xiaojuan, Sorry for let you wait. I just checked the list above and I think this list is very great and most index are common to all database products. But just talk about DB2, here we have a product called DMC(data management console). It is a is an integrated database management tools platform that you can use to manage DB2 LUW. The metrix data collected by DMC is very useful for DB2 user to monitor the running of DB2. Perhaps the metrix of DMC can help something. Please refer to below link about DMC collected DB2 related metrix. https://www.ibm.com/docs/en/db2-data-mgr-console/3.1.x?topic=metrics-summary