clients.go 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. // Copyright The OpenTelemetry 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. package otlptrace // import "go.opentelemetry.io/otel/exporters/otlp/otlptrace"
  15. import (
  16. "context"
  17. tracepb "go.opentelemetry.io/proto/otlp/trace/v1"
  18. )
  19. // Client manages connections to the collector, handles the
  20. // transformation of data into wire format, and the transmission of that
  21. // data to the collector.
  22. type Client interface {
  23. // DO NOT CHANGE: any modification will not be backwards compatible and
  24. // must never be done outside of a new major release.
  25. // Start should establish connection(s) to endpoint(s). It is
  26. // called just once by the exporter, so the implementation
  27. // does not need to worry about idempotence and locking.
  28. Start(ctx context.Context) error
  29. // DO NOT CHANGE: any modification will not be backwards compatible and
  30. // must never be done outside of a new major release.
  31. // Stop should close the connections. The function is called
  32. // only once by the exporter, so the implementation does not
  33. // need to worry about idempotence, but it may be called
  34. // concurrently with UploadTraces, so proper
  35. // locking is required. The function serves as a
  36. // synchronization point - after the function returns, the
  37. // process of closing connections is assumed to be finished.
  38. Stop(ctx context.Context) error
  39. // DO NOT CHANGE: any modification will not be backwards compatible and
  40. // must never be done outside of a new major release.
  41. // UploadTraces should transform the passed traces to the wire
  42. // format and send it to the collector. May be called
  43. // concurrently.
  44. UploadTraces(ctx context.Context, protoSpans []*tracepb.ResourceSpans) error
  45. // DO NOT CHANGE: any modification will not be backwards compatible and
  46. // must never be done outside of a new major release.
  47. }