Sometimes people want to change the status of a span from "error" to "unset" or "okay".
In OpenTelemetry, spans have a status code that defines whether they are an error or not. In Honeycomb, these show up as a boolean field called `error` so if the span status is 2, the `error` attribute is `true`, otherwise it's `false`.
In OpenTelemetry's Transform Processor, you can make changes to the attributes using OpenTelemetry Transform Language (OTTL) statements.
Example
Let's say you want to unset the error status on health checks that match the pattern "{something}/health{something}" for a service called "Fries". You can do so with the following statement. Sometimes it returns a 404 error which we don't want to consider an error, but if it returns 500 we do.
processors: transform/resetstatus: trace_statements: - context: span statements: - set(status.code, 1) where resource.attributes["service.name"] == "Fries" and attributes["http.response.status_code"] == 404 and IsMatch(attributes["http.url"], ".*/health.*")
Make sure you then add this processor to your traces pipelines so the changes take effect.
Troubleshooting OTTL with multiple where clauses
If you're not seeing what you expect, you can create a separate troubleshooting column and fill it up with each of the where clauses. We'll call the new column `otelcol.transform.test` and append strings to fill out the column contents.
processors: transform/resetstatus: trace_statements: - context: span statements: - set(attributes["otelcol.transform.test"], "found_service") where resource.attributes["service.name"] == "Fries" - set(attributes["otelcol.transform.test"], Concat([attributes["otelcol.transform.test"], "found_httpstatus"], ",")) where attributes["http.response.status_code"] == 404 - set(attributes["otelcol.transform.test"], Concat([attributes["otelcol.transform.test"], "found_url"], ",")) where IsMatch(attributes["http.url"], ".*/health.*")
By decomposing each of the where clauses into their own fields, you can validate that the status attribute isn't from a different version of Semantic Conventions or the regular expression is actually matching what you expect.