본문으로 바로가기 본문 바로가기
WIKI 기술 지식 베이스

MariaDB 클라이언트 연산 시맨틱 컨벤션

원문 보기 위키 갱신

Status: Stable, Unless otherwise specified.

출처: 문서

본문

  • 스팬
  • 메트릭

스팬

Status:

MariaDB 호출을 나타내는 스팬은 일반 데이터베이스 클라이언트 스팬 시맨틱 컨벤션을 따르며, 추가적으로 이 문서의 속성을 적용해요.

db.system.name MUST be set to "mariadb" and SHOULD be provided at span creation time.

스팬 종류는 CLIENT여야 해요.

스팬 상태는 Recording Errors 문서를 따라야 해요.

Attributes: | | Key | Stability | Requirement Level | Value Type | Description | Example Values

| db.namespace | | Conditionally Required If available without an additional network call. | string | The database associated with the connection. [1] | products; customers

| db.response.status_code | | Conditionally Required If response has ended with warning or an error. | string | Maria DB error code represented as a string. [2] | 1008; 3058

| error.type | | Conditionally Required If and only if the operation failed. | string | Describes a class of error the operation ended with. [3] | timeout; java.net.UnknownHostException; server_certificate_invalid; 500

| server.port | | Conditionally Required [4] | int | Server port number. [5] | 80; 8080; 443

| db.collection.name | | Recommended [6] | string | The name of a collection (table, container) within the database. [7] | public.users; customers

| db.operation.batch.size | | Recommended | int | The number of database operations included in a batch operation. [8] | 2; 3; 4

| db.operation.name | | Recommended [9] | string | The name of the operation or command being executed. [10] | EXECUTE; INSERT

| db.query.summary | | Recommended [11] | string | Low cardinality summary of a database query. [12] | SELECT wuser_table; INSERT shipping_details SELECT orders; get user by id

| db.query.text | | Recommended [13] | string | The database query being executed. [14] | SELECT * FROM wuser_table where username = ?; SET mykey ?

| db.stored_procedure.name | | Recommended [15] | string | The name of a stored procedure within the database. [16] | GetCustomer

| server.address | | Recommended | string | Name of the database host. [17] | example.com; 10.1.2.80; /tmp/my.sock

| db.query.parameter.<key> | | Opt-In | string | A database query parameter, with <key> being the parameter name, and the attribute value being a string representation of the parameter value. [18] | someval; 55

| db.response.returned_rows | | Opt-In | int | Number of rows returned by the operation. [19] | 10; 30; 1000

[1] db.namespace: A connection’s currently associated database may change during its lifetime, e.g. from executing USE <database>.

인스트루멘테이션이 추가 쿼리(예: SELECT DATABASE())를 실행하지 않고도 각 쿼리에서 연결에 현재 연결된 데이터베이스를 캡처할 수 없다면, 연결이 설정될 때 제공된 데이터베이스로 폴백해 사용하는 것이 권장돼요.

인스트루멘테이션은 db.namespace가 연결이 설정될 때 제공된 데이터베이스를 반영하는지 문서화해야 해요.

애플리케이션이 제공한 값을 대소문자 정규화 없이 그대로 캡처하는 것이 권장돼요.

[2] db.response.status_code: MariaDB uses vendor-specific error codes on all errors and reports SQLSTATE in some cases. MariaDB 오류 코드는 SQLSTATE보다 더 세분화되어 있어요. 그래서 MariaDB 인스트루멘테이션은 db.response.status_code를 이 알려진 오류 코드로 설정해야 해요. SQLSTATE를 사용할 수 있다면 Class 02 이상의 SQLSTATE를 오류로 간주해야 해요. SQLSTATE를 사용할 수 없다면 모든 MariaDB 오류 코드를 오류로 간주해야 해요.

[3] error.type: The error.type SHOULD match the db.response.status_code returned by the database or the client library, or the canonical name of exception that occurred. 표준 예외 타입 이름을 사용할 때, 인스트루멘테이션은 가장 관련성이 높은 타입을 보고하도록 최선을 다해야 해요. 예를 들어 원래 예외가 일반 예외로 래핑된 경우에는 원래 예외를 선호해야 해요. 인스트루멘테이션은 error.type을 어떻게 채우는지 문서화해야 해요.

[4] server.port: If using a port other than the default port for this DBMS and if server.address is set.

[5] server.port: When observed from the client side, and when communicating through an intermediary, server.port SHOULD represent the server port behind any intermediaries, for example proxies, if it’s available.

[6] db.collection.name: If the operation is executed via a higher-level API that does not support multiple collection names.

[7] db.collection.name: The collection name SHOULD NOT be extracted from db.query.text.

[8] db.operation.batch.size: Except for empty batch requests described below, a batch operation contains two 하나의 클라이언트 호출, 프로토콜 메시지, 또는 데이터베이스 명령에서 별도의 연산으로 명시적으로 제출된 하나 이상의 데이터베이스 연산을 말해요.

단 하나의 연산만 포함하는 배치 API 요청은 배치 연산이 아닌 단일 연산으로 모델링해야 해요. 연산으로 모델링해야 해요.

하나의 연산이 여러 피연산자(키, 행, 문서, 포인트 등)를 받는다고 해서 데이터베이스 호출이 배치 연산인 것은 아니에요. 예를 들어 여러 키를 받는 Redis MGET도 마찬가지예요. 배치 연산이 아니에요.

매개변수 세트로 동일한 매개변수화 연산을 실행하는 배치 API에서는, 요청이 배치 연산인지 결정할 때 각 매개변수 세트가 하나의 데이터베이스 연산을 나타내요. 매개변수 세트가 하나뿐인 요청은 배치 연산이 아닌 단일 연산으로 모델링해야 해요. 단일 연산으로 모델링해야 해요.

db.operation.batch.size SHOULD be set to the number of operations in the batch. 배치가 아닌 연산에는 설정하면 안 돼요.

연산이 없는 배치 연산 실행 요청도 배치 연산으로 취급해야 하며, db.operation.batch.size는 0으로 설정해야 해요.

[9] db.operation.name: If the operation is executed via a higher-level API that does not support multiple operation names.

[10] db.operation.name: The operation name SHOULD NOT be extracted from db.query.text.

[11] db.query.summary: if available through instrumentation hooks or if the instrumentation supports generating a query summary.

[12] db.query.summary: The query summary describes a class of database queries and is useful 특히 복잡한 쿼리가 포함된 데이터베이스 호출의 텔레메트리를 분석할 때 그룹화 키로 유용해요. 복잡한 쿼리를 포함한 호출을 분석할 때요.

요약(summary)은 인스트루멘테이션 훅이나 다른 수단을 통해 인스트루멘테이션에 제공될 수 있어요. 사용할 수 없다면, 쿼리 파싱을 지원하는 인스트루멘테이션은 Generating query summary 섹션에 따라 요약을 생성해야 해요. Generating query summary라는 섹션을 따라야 해요.

배치 연산의 경우, 개별 연산이 동일한 쿼리 요약을 가진다고 알려져 있다면 그 쿼리 요약 앞에 BATCH 를 붙여 사용해야 해요. 그렇지 않으면 db.query.summary는 BATCH 또는 더 적절한 경우 다른 데이터베이스 시스템 특유의 용어여야 해요.

[13] db.query.text: Non-parameterized query text SHOULD NOT be collected by default unless there is sanitization that excludes sensitive data, e.g. by redacting all literal values present in the query text. See Sanitization of db.query.text. 매개변수화된 쿼리 텍스트는 기본적으로 수집해야 해요(쿼리 매개변수 값 자체는 옵트인이며, db.query.parameter.<key> 참고).

[14] db.query.text: For sanitization see Sanitization of db.query.text. 배치 연산의 경우, 개별 연산이 동일한 쿼리 텍스트를 가진다고 알려져 있다면 그 쿼리 텍스트를 사용해야 해요. 그렇지 않으면 모든 개별 쿼리 텍스트를 구분자 ; (또는 더 적절한 경우 다른 데이터베이스 시스템 특유의 구분자)로 연결해야 해요. 매개변수화된 쿼리 텍스트는 정화(sanitize)하면 안 돼요. 매개변수화된 쿼리 텍스트는 민감한 데이터를 잠재적으로 가질 수 있지만, 사용자가 매개변수화된 쿼리를 사용한다는 것은 민감한 데이터를 매개변수 값으로 전달하겠다는 강한 신호를 주는 것이며, 기본적으로 쿼리 텍스트의 정적 부분을 캡처함으로써 얻는 관측 가능성 이점이 그 위험보다 크기 때문이에요.

[15] db.stored_procedure.name: If operation applies to a specific stored procedure.

[16] db.stored_procedure.name: It is RECOMMENDED to capture the value as provided by the application 대소문자 정규화 없이 그대로 사용해야 해요.

배치 연산의 경우, 개별 연산이 동일한 저장 프로시저 이름을 가진다고 알려져 있다면 그 이름을 사용해야 해요.

[17] server.address: When observed from the client side, and when communicating through an intermediary, server.address SHOULD represent the server address behind any intermediaries, for example proxies, if it’s available.

[18] db.query.parameter.<key>: If a query parameter has no name and instead is referenced only by index, 그러면 <key>는 0 기반 인덱스여야 해요.

db.query.parameter.<key> SHOULD match db.query.text에 있는 매개변수화된 플레이스홀더와 맞춰야 해요.

애플리케이션이 제공한 값을 대소문자 정규화나 정화 없이 그대로 캡처하는 것이 권장돼요.

인스트루멘테이션은 기본적으로 db.query.parameter.<key>를 캡처하면 안 돼요. 값이 PII나 민감한 세부 정보를 포함할 수 있기 때문이에요. 애플리케이션 운영자는 프라이버시와 보안 고려 사항에 따라 특정 키를 활성화할 것으로 기대돼요.

db.query.parameter.<key> SHOULD NOT be captured on batch operations.

예시:

쿼리 SELECT * FROM users where username = %s에 매개변수 "jdoe"를 사용하면, 속성 db.query.parameter.0은 "jdoe"로 설정해야 해요.

For a query "SELECT * FROM users WHERE username = %(userName)s; with parameter userName = "jdoe", the attribute db.query.parameter.userName SHOULD be set to "jdoe".

[19] db.response.returned_rows: The number of rows returned by the database operation as observed 스팬이 끝날 때 인스트루멘테이션이 설정해야 해요.

다음 속성들은 샘플링 결정을 내리는 데 중요할 수 있으므로, 스팬 생성 시점(제공한다면)에 제공되어야 해요:

  • db.namespace
  • db.query.summary
  • db.query.text
  • server.address
  • server.port

error.type has the following list of well-known values. If one of them applies, then the respective value MUST be used; otherwise, a custom value MAY be used. | | Value | Description | Stability

| _OTHER | A fallback error value to be used when the instrumentation doesn’t define a custom value. |

메트릭

MariaDB 클라이언트 인스트루멘테이션은 일반 데이터베이스 클라이언트 메트릭 시맨틱 컨벤션에 따라 메트릭을 수집해야 해요.

db.system.name MUST be set to "mariadb".