-
Notifications
You must be signed in to change notification settings - Fork 255
[OTEL Web SDK] Add Logs Interfaces #2661
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
[OTEL Web SDK] Add Logs Interfaces #2661
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces OpenTelemetry logging interfaces for the Application Insights JavaScript SDK. It adds comprehensive interface definitions for the logging API, including log records, loggers, processors, and various configuration options.
Key changes:
- Adds core log record interfaces (
IOTelLogRecord,IOTelSdkLogRecord, andReadableLogRecord) - Introduces logger and logger provider interfaces with configuration options
- Defines log record processors, exporters, and batch processing configurations
- Adds severity level enums and type definitions for log attributes and bodies
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| IOTelSdkLogRecord.ts | Defines the SDK log record interface with read-write capabilities and builder methods |
| IOTelReadableLogRecord.ts | Defines read-only log record interface for consumption by processors/exporters |
| IOTelLoggerProviderConfig.ts | Configuration interface for logger provider including resource, limits, and processors |
| IOTelLoggerProvider.ts | Logger provider interface for creating named loggers |
| IOTelLoggerOptions.ts | Options interface for logger configuration including schema URL and trace context |
| IOTelLogger.ts | Core logger interface defining the emit method |
| IOTelLogRecordProcessor.ts | Processor interface for handling emitted log records |
| IOTelLogRecordLimits.ts | Configuration limits for log record attributes |
| IOTelLogRecordExporter.ts | Exporter interface (currently placeholder with commented sections) |
| IOTelLogRecord.ts | Base log record interface with input properties |
| IOTelBufferConfig.ts | Buffer configuration for batch processing |
| IOTelBatchLogRecordProcesorBrowserConfig.ts | Browser-specific batch processor configuration |
| OTelSeverityNumber.ts | Enum defining log severity levels |
| OTelAnyValue.ts | Type definitions for flexible log attribute and body values |
shared/OpenTelemetry/src/interfaces/logs/IOTelLogRecordProcessor.ts
Outdated
Show resolved
Hide resolved
…or.ts Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This pull request introduces a comprehensive set of new TypeScript interfaces and enums to the
shared/OpenTelemetry/srcdirectory, laying the groundwork for OpenTelemetry log record processing in the codebase. The changes add key abstractions for log records, loggers, processors, configuration, and severity levels, enabling structured logging and extensibility for future OpenTelemetry features.Log Record and Severity Abstractions
OTelSeverityNumberenum to standardize numerical severity levels for logs, supporting granular trace, debug, info, warn, error, and fatal levels. (OTelSeverityNumber.ts)IOTelLogRecordandIOTelSdkLogRecordinterfaces to define the structure and mutator methods for log records, including attributes, body, severity, timestamps, and context. (IOTelLogRecord.ts,IOTelSdkLogRecord.ts) [1] [2]ReadableLogRecordinterface for immutable log record representation with high-resolution timestamps and dropped attribute tracking. (IOTelReadableLogRecord.ts)Logger and Processor Interfaces
IOTelLogger,IOTelLoggerProvider, andIOTelLoggerOptionsinterfaces to support logger creation, configuration, and log emission. (IOTelLogger.ts,IOTelLoggerProvider.ts,IOTelLoggerOptions.ts) [1] [2] [3]IOTelLogRecordProcessorinterface for log record processing lifecycle management, including force flush, shutdown, and onEmit handling. (IOTelLogRecordProcessor.ts)Configuration and Exporter Support
IOTelBufferConfig,IOTelBatchLogRecordProcessorBrowserConfig, andIOTelLogRecordLimits, supporting advanced log export and processing strategies. (IOTelBufferConfig.ts,IOTelBatchLogRecordProcessorBrowserConfig.ts,IOTelLogRecordLimits.ts) [1] [2] [3]IOTelLogRecordExporterinterface to allow configuration of different log exporters (console, OTLP HTTP/gRPC/file), preparing for future extensibility. (IOTelLogRecordExporter.ts)IOTelLoggerProviderConfigfor centralized logger provider configuration, including resource, flush timeout, log record limits, and processor registration. (IOTelLoggerProviderConfig.ts)These additions set up the foundation for OpenTelemetry-compliant logging, enabling structured log creation, processing, and export in the browser and other environments.