MCPcopy Create free account
hub / github.com/instantdb/instant / appendLogfmtKey

Method appendLogfmtKey

server/src/java/instant/Logfmt.java:105–120  ·  view source on GitHub ↗

Append a logfmt key into sb, normalising two characters that are inconvenient downstream: . is rewritten as _. Many OTel semantic-convention keys are dotted (exception.type, http.method, db.statement, …); a dot in a logfmt key r

(StringBuilder sb, String key)

Source from the content-addressed store, hash-verified

103 * append, no allocation.
104 */
105 public static void appendLogfmtKey(StringBuilder sb, String key) {
106 if (key.indexOf('.') < 0 && key.indexOf('?') < 0) {
107 sb.append(key);
108 return;
109 }
110 int n = key.length();
111 for (int i = 0; i < n; i++) {
112 char c = key.charAt(i);
113 if (c == '?') {
114 // Drop, don't replace — `rate_limited` reads better than
115 // `rate_limited_`.
116 continue;
117 }
118 sb.append(c == '.' ? '_' : c);
119 }
120 }
121}

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected