File size: 2,869 Bytes
31e8457
 
 
 
 
 
 
 
051bada
 
 
 
 
 
 
 
31e8457
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
051bada
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31e8457
 
 
 
051bada
 
 
 
31e8457
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
import { flow } from "../../Function.js";
import * as Layer from "../../Layer.js";
import * as HttpClientRequest from "../http/HttpClientRequest.js";
import * as OtlpLogger from "./OtlpLogger.js";
import * as OtlpMetrics from "./OtlpMetrics.js";
import * as OtlpSerialization from "./OtlpSerialization.js";
import * as OtlpTracer from "./OtlpTracer.js";
/**
 * Creates a combined OTLP layer for logs, metrics, and traces.
 *
 * **Details**
 *
 * The layer sends data to `/v1/logs`, `/v1/metrics`, and `/v1/traces` below
 * `baseUrl` and requires an `OtlpSerialization` implementation.
 *
 * @category layers
 * @since 4.0.0
 */
export const layer = options => {
  const base = HttpClientRequest.get(options.baseUrl);
  const url = path => HttpClientRequest.appendUrl(base, path).url;
  return Layer.mergeAll(OtlpLogger.layer({
    url: url("/v1/logs"),
    resource: options.resource,
    headers: options.headers,
    exportInterval: options.loggerExportInterval,
    maxBatchSize: options.maxBatchSize,
    shutdownTimeout: options.shutdownTimeout,
    excludeLogSpans: options.loggerExcludeLogSpans,
    mergeWithExisting: options.loggerMergeWithExisting
  }), OtlpMetrics.layer({
    url: url("/v1/metrics"),
    resource: options.resource,
    headers: options.headers,
    exportInterval: options.metricsExportInterval,
    shutdownTimeout: options.shutdownTimeout,
    temporality: options.metricsTemporality
  }), OtlpTracer.layer({
    url: url("/v1/traces"),
    resource: options.resource,
    headers: options.headers,
    exportInterval: options.tracerExportInterval,
    maxBatchSize: options.maxBatchSize,
    context: options.tracerContext,
    shutdownTimeout: options.shutdownTimeout
  }));
};
/**
 * Creates a combined OTLP layer for logs, metrics, and traces from
 * OpenTelemetry configuration.
 *
 * @category layers
 * @since 4.0.0
 */
export const layerFromConfig = options => Layer.mergeAll(OtlpLogger.layerFromConfig({
  resource: options?.resource,
  headers: options?.headers,
  excludeLogSpans: options?.loggerExcludeLogSpans,
  mergeWithExisting: options?.loggerMergeWithExisting
}), OtlpMetrics.layerFromConfig({
  resource: options?.resource,
  headers: options?.headers
}), OtlpTracer.layerFromConfig({
  resource: options?.resource,
  headers: options?.headers,
  context: options?.tracerContext
}));
/**
 * Creates the combined OTLP logs, metrics, and traces layer using JSON
 * serialization.
 *
 * @category layers
 * @since 4.0.0
 */
export const layerJson = /*#__PURE__*/flow(layer, /*#__PURE__*/Layer.provide(OtlpSerialization.layerJson));
/**
 * Creates the combined OTLP logs, metrics, and traces layer using protobuf
 * serialization.
 *
 * @category layers
 * @since 4.0.0
 */
export const layerProtobuf = /*#__PURE__*/flow(layer, /*#__PURE__*/Layer.provide(OtlpSerialization.layerProtobuf));
//# sourceMappingURL=Otlp.js.map