You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* feat: replace hardcoded span start function names with regex patterns
Replaces the hardcoded list of function names and packages with a list
of regex patterns that may be extended using the
`-extra-start-span-signatures` command line option.
The format is `<regex>:<telemetry-type>`. Ideally this would just be a
list of regex patterns, but we need to know what telemetry library we're
matching so we don't run RecordError on opencensus.
* tests: update tests to use new default config
The tests need to unconditionally include the
DefaultStartSpanSignatures, which was not possible with the old harness.
Instead of returning an object directly, they now return a function to
prepare a config, which ensures they all start out with the default
config as a base.
* Add test, skip validating spans within starter funcs
* Hack: fix check for start func method name
* fix: increase robustness of skipping custom matchers
Instead of checking if the function name matches, which might result in
overzealous exclusions, prefer to match against the function signature
itself
* docs: document new behaviour
* Remove sig split in config
* nit: small wording changes
---------
Co-authored-by: josh <[email protected]>
By default, Span creation will be tracked from calls to [(go.opentelemetry.io/otel/trace.Tracer).Start](https://github.com/open-telemetry/opentelemetry-go/blob/98b32a6c3a87fbee5d34c063b9096f416b250897/trace/trace.go#L523), [go.opencensus.io/trace.StartSpan](https://pkg.go.dev/go.opencensus.io/trace#StartSpan), or [go.opencensus.io/trace.StartSpanWithRemoteParent](https://github.com/census-instrumentation/opencensus-go/blob/v0.24.0/trace/trace_api.go#L66).
136
+
137
+
You can use the `-extra-start-span-signatures` flag to list additional Span creation functions. For all such functions:
138
+
139
+
1. their Spans will be linted (for all enable checks)
140
+
1. checks will be disabled (i.e. there is no linting of Spans within the creation functions)
141
+
142
+
You must pass a comma-separated list of regex patterns and the telemetry library corresponding to the returned Span. Each entry should be of the form `<regex>:<telemetry-type>`, where `telemetry-type` can be `opentelemetry` or `opencensus`. For example, if you have created a function named `StartTrace` in a `telemetry` package, using the `go.opentelemetry.io/otel` library, you can include this function for analysis like so:
Tracing is a celebrated [[1](https://andydote.co.uk/2023/09/19/tracing-is-better/),[2](https://charity.wtf/2022/08/15/live-your-best-life-with-structured-events/)] and well marketed [[3](https://docs.datadoghq.com/tracing/),[4](https://www.honeycomb.io/distributed-tracing)] pillar of observability. But self-instrumented tracing requires a lot of easy-to-forget boilerplate:
Copy file name to clipboardExpand all lines: cmd/spancheck/main.go
+6Lines changed: 6 additions & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -23,11 +23,17 @@ func main() {
23
23
// Set the list of function signatures to ignore checks for.
24
24
ignoreCheckSignatures:=""
25
25
flag.StringVar(&ignoreCheckSignatures, "ignore-check-signatures", "", "comma-separated list of regex for function signatures that disable checks on errors")
26
+
27
+
extraStartSpanSignatures:=""
28
+
flag.StringVar(&extraStartSpanSignatures, "extra-start-span-signatures", "", "comma-separated list of regex:telemetry-type for function signatures that indicate the start of a span")
0 commit comments