-
Notifications
You must be signed in to change notification settings - Fork 135
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
Base type inside envelope always equals to request data. #713
Comments
@goto1 I tried code snippet you added and telemetry processor works as expected, I can see "ExceptionData" as envelope.data.baseType, is it possible another telemetry processor was added and is modifying the envelope? if you are seeing correct events in Azure this could means there is some issue in your local environment, is also possible multiple telemetry events are triggered in your middleware function please validate all of them while debugging. |
@hectorhdzg thank you for your response, I re-installed my project dependencies and that seemed to fix the issue, thanks! Also, if I may ask about something else, would you happen to know if there's a way to populate the Currently I am using a custom property to store this information but don't always have the ability to filter or sort logs by custom properties. appInsights.defaultClient.addTelemetryProcessor(
(envelope, context) => {
const getContextKey = (key) => appInsights.defaultClient.context.keys[key]
const setContextKey = (key, value) => {
envelope.tags[key] = value
}
const requestContext = appInsights.getCorrelationContext().requestContext // custom request context
const data = envelope.data.baseData
const { userId, os, browser } = requestContext
// this is what I would like to do for `client_Browser`, or something similar
// so that `client_Browser` field gets populated with appropriate information
setContextKey(getContextKey("deviceOSVersion"), os)
setContextKey(getContextKey("userId"), userId)
// setting a custom property, but this doesn't populate the `client_Browser` field
data.properties.browser = browser
return true
}
) Any help would be greatly appreciated, thanks! |
Glad it works now, you could use envelope.tags["ai.device.browser"] |
Hello,
I would like to be able to exclude specific requests based on the
evenlope.data.baseType
.Currently, I have the following setup:
However, it appears that
evenlope.data.baseType
always comes back asRequestData
and I am never seeing any other types, such asExceptionData
, as specified in the example from the documentation,This is true when I manually try to trigger an exception in one of my middleware functions,
I've looked at this issue #325, which suggests to look at the value of
envelope.data.baseType
to determine whether to send the telemetry or not, but I am always gettingRequestData
forbaseType
.In the Azure portal, however, I am seeing those exceptions being logged no problem, so technically they should be getting processed through my custom telemetry processor.
Any tips would be greatly appreciated, thank you!
Setup information:
node v14.15.1
applicationinsights v1.8.8
The text was updated successfully, but these errors were encountered: