Skip to content

Commit

Permalink
Empty tags fixing
Browse files Browse the repository at this point in the history
  • Loading branch information
wolfgangB33r committed Jan 7, 2021
1 parent 92943b3 commit 8fdcbe3
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 56 deletions.
93 changes: 47 additions & 46 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

21 changes: 12 additions & 9 deletions src/dynatrace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,16 +61,19 @@ export async function sendMetrics(

for (const m of metrics) {
lines = lines.concat(safeMetricKey(m.metric))
for (const [key, value] of Object.entries(m.dimensions)) {
if (value && value.length > 0) {
lines = lines
.concat(',')
.concat(safeDimKey(key))
.concat('="')
.concat(safeDimValue(value))
.concat('"')
if(m.dimensions) {
for (const [key, value] of Object.entries(m.dimensions)) {
if (value && value.length > 0) {
lines = lines
.concat(',')
.concat(safeDimKey(key))
.concat('="')
.concat(safeDimValue(value))
.concat('"')
}
}
}

lines = lines.concat(' ').concat(m.value).concat('\n')
}
core.info(lines)
Expand All @@ -97,7 +100,7 @@ export async function sendEvents(
for (const e of events) {
const tagAttachRules : TagAttachRule[] = [];
// extract tagging rules
if(e.hasOwnProperty('tags')) {
if(e.tags) {
for (const t of e.tags) {
const arr = t.split(':')
if (arr.length === 2) {
Expand Down

0 comments on commit 8fdcbe3

Please sign in to comment.