OTelExporter constructor

OTelExporter({
  1. required Uri endpoint,
  2. Map<String, String> headers = const {},
  3. String serviceName = 'dart_ipfs',
  4. Client? httpClient,
  5. Logger? logger,
  6. Duration requestTimeout = const Duration(seconds: 10),
})

Creates an OTLP/HTTP exporter that POSTs to endpoint.

headers are merged into every request on top of the default Content-Type: application/json header. serviceName is reported as the service.name resource attribute. An optional httpClient may be injected for testing; otherwise the exporter owns and closes its client in close.

Implementation

OTelExporter({
  required Uri endpoint,
  Map<String, String> headers = const {},
  String serviceName = 'dart_ipfs',
  http.Client? httpClient,
  Logger? logger,
  Duration requestTimeout = const Duration(seconds: 10),
}) : _endpoint = endpoint,
     _headers = Map.unmodifiable(headers),
     _serviceName = serviceName,
     _httpClient = httpClient ?? http.Client(),
     _ownsHttpClient = httpClient == null,
     _logger = logger ?? Logger('OTelExporter'),
     _requestTimeout = requestTimeout;