(t *testing.T)
| 224 | } |
| 225 | |
| 226 | func TestOTelSpanCreatedWithTenantAttribute(t *testing.T) { |
| 227 | t.Cleanup(spanExporter.Reset) |
| 228 | |
| 229 | ctx := user.InjectOrgID(context.Background(), "team-a") |
| 230 | sp, _ := NewOTel(ctx, log.NewNopLogger(), tracer, "name", tenant.NewMultiResolver()) |
| 231 | sp.Finish() |
| 232 | |
| 233 | spans := spanExporter.GetSpans() |
| 234 | require.Len(t, spans, 1, "There should be exactly one span after the span is finished") |
| 235 | exportedSpan := spans[0] |
| 236 | |
| 237 | require.Equal(t, []attribute.KeyValue{attribute.StringSlice(TenantIDsTagName, []string{"team-a"})}, exportedSpan.Attributes) |
| 238 | } |
| 239 | |
| 240 | func TestOTelSpanCreatedWithMultipleTenantsAttribute(t *testing.T) { |
| 241 | t.Cleanup(spanExporter.Reset) |
nothing calls this directly
no test coverage detected