pixie
pixie copied to clipboard
Support opentelemetry logs
I'd love to be able to emit data as opentelemetry logs since the data model is stable: https://opentelemetry.io/docs/reference/specification/logs/data-model/#log-and-event-record-definition
An example of what I might expect to be able to do:
# ... some stuff from http_events
px.export(
df, px.otel.Data(
resource={
'service.name': df.service,
'k8s.container.name': df.container,
'service.instance.id': df.pod,
'k8s.pod.name': df.pod,
'k8s.namespace.name': df.namespace,
'px.cluster.id': df.cluster_id,
'k8s.cluster.name': df.cluster_name,
'instrumentation.provider': df.pixie,
},
data=[
px.otel.Log(
# required
timestamp=df.time_,
# required
severity_number=9
# required
severity_text='info'
body={
'name': 'phillip's sweet log'
'parent.service.name': df.parent_service,
'parent.k8s.pod.name': df.parent_pod,
'http.method': df.req_method,
'http.url': df.req_url,
'http.target': df.req_path,
'http.host': df.host,
'http.status_code': df.resp_status,
'http.user_agent': df.user_agent,
'http.request_content_length': df.req_body_size,
'http.response_content_length': df.resp_body_size,
'http.request.header': df.req_headers,
'http.response.header': df.resp_headers,
},
),
],
),
)
It feels like a more natural fit for http_events compared to OTel spans, since there's no (apparent) way to propagate trace info in HTTP headers.
@cartermp I know it's been a while since you opened this issue, but I'm actively working on log support. I have it fully working end to end and I'm starting to merge the changes in one by one.
It should hoepfully be available in the next few weeks.