Diff compares the list of spans and metric data obtained from OpenTelemetry instrumentation (using a test exporter like `sdktrace/tracetest.NewExporter` and `sdkmetric/metrictest.NewExporter`) with an expected list of calls. The span/metric name and status code/status attribute are compared. Order m
(gotSpans []sdktrace.ReadOnlySpan, gotMetrics []metricdata.ScopeMetrics, namePrefix, provider string, want []Call)
| 67 | // provider is the name of the provider used (e.g., "aws"). |
| 68 | // want is the list of expected calls. |
| 69 | func Diff(gotSpans []sdktrace.ReadOnlySpan, gotMetrics []metricdata.ScopeMetrics, namePrefix, provider string, want []Call) string { |
| 70 | ds := diffSpans(gotSpans, namePrefix, want) |
| 71 | dc := DiffMetrics(gotMetrics, namePrefix, provider, want) |
| 72 | if len(ds) > 0 { |
| 73 | ds = "trace: " + ds + "\n" |
| 74 | } |
| 75 | if len(dc) > 0 { |
| 76 | dc = "metrics: " + dc |
| 77 | } |
| 78 | return ds + dc |
| 79 | } |
| 80 | |
| 81 | func mapStatusCode(code gcerrors.ErrorCode) codes.Code { |
| 82 | // For gcerrors used by gocloud, OK -> Ok, everything else -> Error is common. |