OpenTelemetry 엔벨로프 (OpenTelemetry envelope)
OpenTelemetry envelope 프로세서는 데이터를 OpenTelemetry 로그 스키마와 호환되도록 변환해 줘요. 데이터가 OpenTelemetry 입력 플러그인으로 생성된 게 아니라면, OpenTelemetry 호환 스키마를 기대하는 목적지로 데이터를 보내기 전에 이 프로세서를 사용할 수 있어요.
출처: 문서
본문
OpenTelemetry envelope 프로세서는 데이터를 OpenTelemetry 로그 스키마와 호환되도록 변환해 줘요. 데이터가 OpenTelemetry 입력 플러그인으로 생성된 게 아니라면, OpenTelemetry 호환 스키마를 기대하는 목적지로 데이터를 보내기 전에 이 프로세서를 사용할 수 있어요.

참고: 프로세서는 YAML 설정 파일에서만 지원돼요.
Configuration parameters (설정 매개변수)
OpenTelemetry envelope 프로세서는 설정 매개변수를 사용하지 않아요.
Examples (예시)
다음 예시는 dummy 입력 플러그인으로 초당 샘플 메시지 하나를 생성한 뒤, opentelemetry_envelope 프로세서로 그 메시지들을 변환해요. 변환된 데이터는 stdout과 opentelemetry 출력 플러그인으로 보내져요.
{% tabs %} {% tab title="fluent-bit.yaml" %}
service:
flush: 1
log_level: info
pipeline:
inputs:
- name: dummy
dummy: '{"message": "Hello World"}'
processors:
logs:
- name: opentelemetry_envelope
outputs:
- name : stdout
match: '*'
- name: opentelemetry
match: '*'
host: 127.0.0.1
port: 4318
{% endtab %}
{% tab title="otel-collector.yaml" %}
receivers:
otlp:
protocols:
http:
endpoint: 127.0.0.1:4318
exporters:
file:
path: out.json
logging:
loglevel: info
service:
telemetry:
logs:
level: debug
pipelines:
logs:
receivers: [otlp]
exporters: [file, logging]
{% endtab %} {% endtabs %}
Fluent Bit의 표준 출력은 스키마의 원시 표현을 출력해요. 하지만 OpenTelemetry collector는 데이터를 OpenTelemetry 호환 형식으로 받아요.
out.json 출력 파일을 살펴보면 다음과 비슷한 OpenTelemetry 호환 데이터를 볼 수 있어요:
{
"resourceLogs": [
{
"resource": {},
"scopeLogs": [
{
"scope": {},
"logRecords": [
{
"timeUnixNano": "1722904188085758000",
"body": {
"stringValue": "dummy"
},
"traceId": "",
"spanId": ""
}
]
}
]
}
]
}
추가 변환에 관심이 있다면 content modifier 프로세서를 사용해서 로그 내용을 수정할 수도 있어요. 다음 예시는 로그에 리소스(resource)와 스코프(scope) 속성을 추가하는 방법을 보여줘요:
{% tabs %} {% tab title="fluent-bit.yaml" %}
service:
flush: 1
log_level: info
pipeline:
inputs:
- name: dummy
dummy: '{"message": "Hello World"}'
processors:
logs:
- name: opentelemetry_envelope
- name: content_modifier
context: otel_resource_attributes
action: upsert
key: service.name
value: my-service
outputs:
- name : stdout
match: '*'
- name: opentelemetry
match: '*'
host: 127.0.0.1
port: 4318
{% endtab %} {% endtabs %}
collector JSON 출력은 다음과 비슷할 거예요:
{
"resourceLogs": [
{
"resource": {
"attributes": [
{
"key": "service.name",
"value": {
"stringValue": "my-service"
}
}
]
},
"scopeLogs": [
{
"scope": {},
"logRecords": [
{
"timeUnixNano": "1722904465173450000",
"body": {
"stringValue": "Hello World"
},
"traceId": "",
"spanId": ""
}
]
}
]
}
]
}
추가 처리에 대한 자세한 내용은 content modifier 프로세서 문서를 읽어보세요.