No
FYI Java code for adding logs in span event
final Span currentSpan = Span.current();
AttributesBuilder builder = Attributes.builder();
if (currentSpan != null) {
builder.put("logger", event.getLoggerName())
.put("level", event.getLevel().toString())
.put("message", event.getFormattedMessage());
currentSpan.addEvent("LogEvent", builder.build());
if (Level.ERROR.equals(event.getLevel())) {
currentSpan.setStatus(StatusCode.ERROR);
}
IThrowableProxy throwableProxy = event.getThrowableProxy();
if (throwableProxy instanceof ThrowableProxy) {
Throwable throwable = ((ThrowableProxy) throwableProxy).getThrowable();
if (throwable != null) {
currentSpan.recordException(throwable);
}
}
}
Discover JSON Span Document for ref:
{
"_index": "apm-7.17.4-span-000001",
"_type": "_doc",
"_id": "m_y-7oMBmPpmpWN3RIb-",
"_version": 1,
"_score": 1,
"_source": {
"parent": {
"id": "88bc9e45ea1b3e7b"
},
"agent": {
"name": "opentelemetry/java",
"version": "1.18.0"
},
"processor": {
"name": "transaction",
"event": "span"
},
"labels": {
"process_runtime_description": "Oracle Corporation OpenJDK 64-Bit Server VM 17.0.2+8-86",
"thread_id": 81,
"thread_name": "graphql-exec-1",
"graphql_operation_type": "mutation",
"graphql_document": "mutation {\n _0_createWorkspace: createWorkspace(newWorkspace: ?) {\n workspace {\n id\n description\n comment\n type\n participants {\n user\n isOwner\n }\n groups {\n entityNumber\n id\n sequenceNumber\n stageId\n entities {\n entityNumber\n id\n iditId\n defPackageId\n domain\n }\n }\n }\n }\n}",
"telemetry_auto_version": "1.18.0"
},
"observer": {
"hostname": "efk-dev-apm-server-6dc9bcb969-wwg74",
"id": "f509f864-2f8f-4399-9418-267b5ba06e4a",
"ephemeral_id": "ff494f46-36cc-4b4f-9fb1-10d6514bde07",
"type": "apm-server",
"version": "7.17.4",
"version_major": 7
},
"trace": {
"id": "07430797357ef24ea7383545285d9819"
},
"@timestamp": "2022-10-19T05:36:25.751Z",
"ecs": {
"version": "1.12.0"
},
"service": {
"name": "workspace"
},
"event": {
"outcome": "unknown"
},
"timestamp": {
"us": 1666157785751514
},
"span": {
"duration": {
"us": 980639
},
"name": "mutation",
"id": "4540b33e31271de2",
"type": "app"
}
},
"fields": {
"span.name": [
"mutation"
],
"labels.process_runtime_description": [
"Oracle Corporation OpenJDK 64-Bit Server VM 17.0.2+8-86"
],
"labels.graphql_operation_type": [
"mutation"
],
"labels.thread_id": [
81
],
"labels.graphql_document": [
"mutation {\n _0_createWorkspace: createWorkspace(newWorkspace: ?) {\n workspace {\n id\n description\n comment\n type\n participants {\n user\n isOwner\n }\n groups {\n entityNumber\n id\n sequenceNumber\n stageId\n entities {\n entityNumber\n id\n iditId\n defPackageId\n domain\n }\n }\n }\n }\n}"
],
"labels.thread_name": [
"graphql-exec-1"
],
"labels.telemetry_auto_version": [
"1.18.0"
],
"trace.id": [
"07430797357ef24ea7383545285d9819"
],
"span.duration.us": [
980639
],
"processor.event": [
"span"
],
"agent.name": [
"opentelemetry/java"
],
"event.outcome": [
"unknown"
],
"service.name": [
"workspace"
],
"processor.name": [
"transaction"
],
"span.id": [
"4540b33e31271de2"
],
"observer.version_major": [
7
],
"observer.hostname": [
"efk-dev-apm-server-6dc9bcb969-wwg74"
],
"span.type": [
"app"
],
"observer.id": [
"f509f864-2f8f-4399-9418-267b5ba06e4a"
],
"timestamp.us": [
1666157785751514
],
"@timestamp": [
"2022-10-19T05:36:25.751Z"
],
"observer.ephemeral_id": [
"ff494f46-36cc-4b4f-9fb1-10d6514bde07"
],
"observer.version": [
"7.17.4"
],
"ecs.version": [
"1.12.0"
],
"observer.type": [
"apm-server"
],
"parent.id": [
"88bc9e45ea1b3e7b"
],
"agent.version": [
"1.18.0"
]
}
}