reporter.go 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Copyright 2022 The OpenZipkin Authors
  2. //
  3. // Licensed under the Apache License, Version 2.0 (the "License");
  4. // you may not use this file except in compliance with the License.
  5. // You may obtain a copy of the License at
  6. //
  7. // http://www.apache.org/licenses/LICENSE-2.0
  8. //
  9. // Unless required by applicable law or agreed to in writing, software
  10. // distributed under the License is distributed on an "AS IS" BASIS,
  11. // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. // See the License for the specific language governing permissions and
  13. // limitations under the License.
  14. /*
  15. Package reporter holds the Reporter interface which is used by the Zipkin
  16. Tracer to send finished spans.
  17. Subpackages of package reporter contain officially supported standard
  18. reporter implementations.
  19. */
  20. package reporter
  21. import "github.com/openzipkin/zipkin-go/model"
  22. // Reporter interface can be used to provide the Zipkin Tracer with custom
  23. // implementations to publish Zipkin Span data.
  24. type Reporter interface {
  25. Send(model.SpanModel) // Send Span data to the reporter
  26. Close() error // Close the reporter
  27. }
  28. type noopReporter struct{}
  29. func (r *noopReporter) Send(model.SpanModel) {}
  30. func (r *noopReporter) Close() error { return nil }
  31. // NewNoopReporter returns a no-op Reporter implementation.
  32. func NewNoopReporter() Reporter {
  33. return &noopReporter{}
  34. }