Skip to content
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

Remove throw on CorrelationContext.customProperties.setProperty #280

Merged
merged 5 commits into from
Jun 14, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 14 additions & 3 deletions AutoCollection/CorrelationContextManager.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import http = require("http");
import Util = require("../Library/Util");
import Logging = require("../Library/Logging");

import {channel} from "diagnostic-channel";

export interface CustomProperties {
getProperty(prop: string): string;
setProperty(prop: string, val: string): void;
/**
* Get a custom property from the correlation context
*/
getProperty(key: string): string;
/**
* Store a custom property in the correlation context.
* Do not store sensitive information here.
* Properties stored here are exposed via outgoing HTTP headers for correlating data cross-component.
* The characters ',' and '=' are disallowed within keys or values.
*/
setProperty(key: string, value: string): void;
}

export interface PrivateCustomProperties extends CustomProperties {
Expand Down Expand Up @@ -288,7 +298,8 @@ class CustomPropertiesImpl implements PrivateCustomProperties {
// properties. The logic here will need to change to track that.
public setProperty(prop: string, val: string) {
if (CustomPropertiesImpl.bannedCharacters.test(prop) || CustomPropertiesImpl.bannedCharacters.test(val)) {
throw new Error("Keys and values must not contain ',' or '='");
Logging.warn("Correlation context property keys and values must not contain ',' or '='. setProperty was called with key: " + prop + " and value: "+ val);
return;
}
for (let i = 0; i < this.props.length; ++i) {
const keyval = this.props[i];
Expand Down