Skip to content

Commit 128ea70

Browse files
authored
fix: CDS-2533 - blob-to-otel fix storage account name (#94)
1 parent 55cad0c commit 128ea70

File tree

2 files changed

+16
-7
lines changed

2 files changed

+16
-7
lines changed

BlobToOtel/BlobToOtel/index.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -120,17 +120,23 @@ const eventHubTrigger = async function (context: InvocationContext, eventHubMess
120120
if (!line || !line.trim()) continue; // Skip empty lines
121121

122122
try {
123+
const storageAccountName = event.topic ? event.topic.split('/').pop() : urlParts.hostname.split('.')[0];
124+
const attributes: any = {
125+
'log.type': 'BlobLogRecord',
126+
'blob.container': containerName,
127+
'blob.path': blobPath,
128+
'blob.storage.account': storageAccountName
129+
};
130+
131+
if (event.data?.contentLength) {
132+
attributes['blob.size'] = event.data.contentLength;
133+
}
134+
123135
logger.emit({
124136
severityNumber: logsAPI.SeverityNumber.INFO,
125137
severityText: 'INFO',
126138
body: line,
127-
attributes: {
128-
'log.type': 'BlobLogRecord',
129-
'blob.container': containerName,
130-
'blob.path': blobPath,
131-
'blob.storage.account': event.topic.split('/').pop(),
132-
'blob.size': event.data.contentLength
133-
}
139+
attributes
134140
});
135141
processedLines++;
136142
} catch (lineError) {

BlobToOtel/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
<!-- ### version / full date -->
66
<!-- * [Update/Bug fix] message that describes the changes that you apply -->
77

8+
### 2.3.0 / 26 Jan 2026
9+
* [Fix] Handle undefined event.topic when extracting storage account name
10+
811
### 2.2.0 / 05 Jan 2026
912
[Fix] Improve batching logic
1013
[Update] Use `@opentelemetry/exporter-logs-otlp-http` instead of `@opentelemetry/exporter-logs-otlp-grpc`

0 commit comments

Comments
 (0)