Open marcus13371337 opened 1 year ago
@marcus13371337 can you share the actual telemetry event that is triggering this?, I can see there is some OpenTelemetry that add the warning when the value of the attribute is null, you may want to sanitize the attributes before sending the telemetry
@hectorhdzg I can't reproduce it locally unfortunately. However, it seems as if objects and errors are sent with toString
instead of JSON-serialized (which worked in the earlier version).
I think it's an error on our side, we have a logging to trace converter which was implemented this way:
const getLogProperties = (entry: LogEntry) => {
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const { msg, ...rest } = entry;
return {
...rest,
};
};
const insertTrace = (entry: LogEntry) => {
const inserts: Promise<void>[] = [];
inserts.push(
logHandler.trackTrace({
message: entry.msg,
severity: getLogSeverityName(entry.level),
properties: getLogProperties(entry),
})
);
if (entry.level >= 50) {
const err = new Error(entry.msg);
err.stack = entry.stack || "";
inserts.push(
logHandler.trackException({
exception: err,
properties: getLogProperties(entry),
})
);
}
return Promise.all(inserts);
};
We had to fix that with the following change:
const getLogProperties = (entry: LogEntry) => {
const { msg, ...rest } = entry;
return Object.entries(rest).reduce(
(acc, [key, value]) => ({ ...acc, [key]: JSON.stringify(value) }), // Apperently you need to JSON-stringify in the new version
{}
);
};
const insertTrace = (entry: LogEntry) => {
const inserts: Promise<void>[] = [];
inserts.push(
logHandler.trackTrace({
message: entry.msg,
severity: getLogSeverityName(entry.level),
properties: getLogProperties(entry),
})
);
if (entry.level >= 50) {
const err = new Error(entry.msg);
err.stack = entry.stack || "";
inserts.push(
logHandler.trackException({
exception: err,
properties: getLogProperties(entry),
})
);
}
return Promise.all(inserts);
};
Note the difference in getLogProperties
. I'm not sure if it's a bug or a feature :)
The fix above fixed the issue reported in the logs i.e "ApplicationInsights:Invalid attribute value set for key: req"
@marcus13371337 I believe the above should be solved for you now as of the fix for better serialization handling of values passed to loggers.
Hello,
I just bumped to
3.0.0-beta.6
(from3.0.0-beta.4
) and started noticing a lot of errors in my application:What's up with that? Am I doing something wrong?