For the complete documentation index, see llms.txt. This page is also available as Markdown.

Trace Attributes

API reference for network trace attributes in Luciq APM. Add custom attributes to network requests and monitor them in your performance data.

You can add/edit a custom trace attribute using the following APIs, passing a string key and a string value.

let urlPattern = "*.example.com/*"
let urlPredicate = NSPredicate(format: "SELF LIKE[c] '\(urlPattern)'")
APM.addNetworkTraceAttributesForURL(matching: urlPredicate, owner: self) { trace in
    return [
        "trace": "example"
    ]
}
[LCQAPM addNetworkTraceAttributesForURLMatchingPredicate:[NSPredicate predicateWithFormat:@"SELF LIKE[c] '%@'", @"*.example.com/*"]
                                                   owner:self
                                            usingHandler:^NSDictionary<NSString *,NSString *> * _Nullable(LCQNetworkTrace * _Nonnull networkTrace) {
    return @{
        @"type": @"example"
    };
}];
APM.addOnNetworkTraceListener(new OnNetworkTraceListener(
    new UrlPredicate() {
        @Override
        public boolean check(@NonNull String url) {
            // Add filter here the URL 
            // return boolean
        }
    }); 
    {
        @Override
        public Map<String, String> addAttributesOnFinish(NetworkTrace trace) {
            Map<String, String> map;
            map.put("Key", "Value");
            // Up to five attributes
            return map;
        }
    }
);

Last updated