跳转至

日志桥 API 无操作实现

Status: Experimental

Table of Contents - [LoggerProvider](#loggerprovider) - [Logger Creation](#logger-creation) - [Logger](#logger) - [Emit LogRecord](#emit-logrecord)

Users of OpenTelemetry need a way to disable the API from actually performing any operations. The No-Op OpenTelemetry API implementation (henceforth referred to as the No-Op) provides users with this functionally. It implements the OpenTelemetry Logs Bridge API so that no telemetry is produced and computation resources are minimized.

All language implementations of OpenTelemetry MUST provide a No-Op.

The Logs Bridge API defines classes with various operations. All No-Op classes MUST NOT hold configuration or operational state. All No-op operations MUST accept all defined parameters, MUST NOT validate any arguments received, and MUST NOT return any non-empty error or log any message.

LoggerProvider

The No-Op MUST allow the creation of multiple LoggerProviderss.

Since all LoggerProviderss hold the same empty state, a No-Op MAY provide the same LoggerProvider instances to all creation requests.

Logger Creation

New Logger instances are always created with a LoggerProvider. Therefore, LoggerProvider MUST allow for the creation of Loggers. All Loggers created MUST be an instance of the No-Op Logger.

Since all Loggers will hold the same empty state, a LoggerProvider MAY return the same Logger instances to all creation requests.

Logger

Emit LogRecord

The No-Op Logger MUST allow for emitting LogRecords.