-
Notifications
You must be signed in to change notification settings - Fork 141
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Beta] - "ApplicationInsights:Invalid attribute value set for key: req []" #1168
Comments
@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 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 |
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?
The text was updated successfully, but these errors were encountered: