File size: 5,953 Bytes
31e8457
 
051bada
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
import * as Duration from "../../Duration.ts";
import * as Effect from "../../Effect.ts";
import * as Layer from "../../Layer.ts";
import * as Logger from "../../Logger.ts";
import type * as Scope from "../../Scope.ts";
import type * as Headers from "../http/Headers.ts";
import type * as HttpClient from "../http/HttpClient.ts";
import type { AnyValue, Fixed64, KeyValue, Resource } from "./OtlpResource.ts";
import { OtlpSerialization } from "./OtlpSerialization.ts";
/**
 * Creates an Effect `Logger` that exports log records through OTLP.
 *
 * **Details**
 *
 * The logger serializes records with the configured resource, sends them
 * through the OTLP exporter, and requires `Scope` so pending records can be
 * flushed on shutdown.
 *
 * @category constructors
 * @since 4.0.0
 */
export declare const make: (options: {
    readonly url: string;
    readonly resource?: {
        readonly serviceName?: string | undefined;
        readonly serviceVersion?: string | undefined;
        readonly attributes?: Record<string, unknown>;
    } | undefined;
    readonly headers?: Headers.Input | undefined;
    readonly exportInterval?: Duration.Input | undefined;
    readonly maxBatchSize?: number | undefined;
    readonly shutdownTimeout?: Duration.Input | undefined;
    readonly excludeLogSpans?: boolean | undefined;
}) => Effect.Effect<Logger.Logger<unknown, void>, never, OtlpSerialization | HttpClient.HttpClient | Scope.Scope>;
/**
 * Layer that installs the OTLP logger created by `make`.
 *
 * **Details**
 *
 * By default the OTLP logger is merged with any existing loggers.
 *
 * @category layers
 * @since 4.0.0
 */
export declare const layer: (options: {
    readonly url: string;
    readonly resource?: {
        readonly serviceName?: string | undefined;
        readonly serviceVersion?: string | undefined;
        readonly attributes?: Record<string, unknown>;
    } | undefined;
    readonly headers?: Headers.Input | undefined;
    readonly exportInterval?: Duration.Input | undefined;
    readonly maxBatchSize?: number | undefined;
    readonly shutdownTimeout?: Duration.Input | undefined;
    readonly excludeLogSpans?: boolean | undefined;
    readonly mergeWithExisting?: boolean | undefined;
}) => Layer.Layer<never, never, HttpClient.HttpClient | OtlpSerialization>;
/**
 * Creates an OTLP logs layer from OpenTelemetry configuration.
 *
 * @category layers
 * @since 4.0.0
 */
export declare const layerFromConfig: (options?: {
    readonly resource?: {
        readonly serviceName?: string | undefined;
        readonly serviceVersion?: string | undefined;
        readonly attributes?: Record<string, unknown>;
    } | undefined;
    readonly headers?: Headers.Input | undefined;
    readonly excludeLogSpans?: boolean | undefined;
    readonly mergeWithExisting?: boolean | undefined;
}) => Layer.Layer<never, never, HttpClient.HttpClient | OtlpSerialization>;
/**
 * OTLP logs payload serialized by `OtlpLogger`.
 *
 * @category models
 * @since 4.0.0
 */
export interface LogsData {
    resourceLogs: ReadonlyArray<IResourceLogs>;
}
/** Properties of an InstrumentationScope. */
interface IInstrumentationScope {
    /** InstrumentationScope name */
    name: string;
    /** InstrumentationScope version */
    version?: string;
    /** InstrumentationScope attributes */
    attributes?: Array<KeyValue>;
    /** InstrumentationScope droppedAttributesCount */
    droppedAttributesCount?: number;
}
/** Properties of a ResourceLogs. */
interface IResourceLogs {
    /** ResourceLogs resource */
    resource?: Resource;
    /** ResourceLogs scopeLogs */
    scopeLogs: Array<IScopeLogs>;
    /** ResourceLogs schemaUrl */
    schemaUrl?: string;
}
/** Properties of an ScopeLogs. */
interface IScopeLogs {
    /** IScopeLogs scope */
    scope?: IInstrumentationScope;
    /** IScopeLogs logRecords */
    logRecords?: Array<ILogRecord>;
    /** IScopeLogs schemaUrl */
    schemaUrl?: string | null;
}
/** Properties of a LogRecord. */
interface ILogRecord {
    /** LogRecord timeUnixNano */
    timeUnixNano: Fixed64;
    /** LogRecord observedTimeUnixNano */
    observedTimeUnixNano: Fixed64;
    /** LogRecord severityNumber */
    severityNumber?: ESeverityNumber;
    /** LogRecord severityText */
    severityText?: string;
    /** LogRecord body */
    body?: AnyValue;
    /** LogRecord attributes */
    attributes: Array<KeyValue>;
    /** LogRecord droppedAttributesCount */
    droppedAttributesCount: number;
    /** LogRecord flags */
    flags?: number;
    /** LogRecord traceId */
    traceId?: string | Uint8Array;
    /** LogRecord spanId */
    spanId?: string | Uint8Array;
}
/**
 * Numerical value of the severity, normalized to values described in Log Data Model.
 */
declare const ESeverityNumber: {
    /** Unspecified. Do NOT use as default */
    readonly SEVERITY_NUMBER_UNSPECIFIED: 0;
    readonly SEVERITY_NUMBER_TRACE: 1;
    readonly SEVERITY_NUMBER_TRACE2: 2;
    readonly SEVERITY_NUMBER_TRACE3: 3;
    readonly SEVERITY_NUMBER_TRACE4: 4;
    readonly SEVERITY_NUMBER_DEBUG: 5;
    readonly SEVERITY_NUMBER_DEBUG2: 6;
    readonly SEVERITY_NUMBER_DEBUG3: 7;
    readonly SEVERITY_NUMBER_DEBUG4: 8;
    readonly SEVERITY_NUMBER_INFO: 9;
    readonly SEVERITY_NUMBER_INFO2: 10;
    readonly SEVERITY_NUMBER_INFO3: 11;
    readonly SEVERITY_NUMBER_INFO4: 12;
    readonly SEVERITY_NUMBER_WARN: 13;
    readonly SEVERITY_NUMBER_WARN2: 14;
    readonly SEVERITY_NUMBER_WARN3: 15;
    readonly SEVERITY_NUMBER_WARN4: 16;
    readonly SEVERITY_NUMBER_ERROR: 17;
    readonly SEVERITY_NUMBER_ERROR2: 18;
    readonly SEVERITY_NUMBER_ERROR3: 19;
    readonly SEVERITY_NUMBER_ERROR4: 20;
    readonly SEVERITY_NUMBER_FATAL: 21;
    readonly SEVERITY_NUMBER_FATAL2: 22;
    readonly SEVERITY_NUMBER_FATAL3: 23;
    readonly SEVERITY_NUMBER_FATAL4: 24;
};
type ESeverityNumber = typeof ESeverityNumber[keyof typeof ESeverityNumber];
export {};
//# sourceMappingURL=OtlpLogger.d.ts.map