s3_marshaler.go 1.0 KB

1234567891011121314151617181920212223242526272829303132333435
  1. // Copyright The OpenTelemetry Authors
  2. // SPDX-License-Identifier: Apache-2.0
  3. package awss3exporter // import "github.com/open-telemetry/opentelemetry-collector-contrib/exporter/awss3exporter"
  4. import (
  5. "go.opentelemetry.io/collector/pdata/plog"
  6. "go.opentelemetry.io/collector/pdata/pmetric"
  7. "go.opentelemetry.io/collector/pdata/ptrace"
  8. "go.uber.org/zap"
  9. )
  10. type s3Marshaler struct {
  11. logsMarshaler plog.Marshaler
  12. tracesMarshaler ptrace.Marshaler
  13. metricsMarshaler pmetric.Marshaler
  14. logger *zap.Logger
  15. fileFormat string
  16. }
  17. func (marshaler *s3Marshaler) MarshalTraces(td ptrace.Traces) ([]byte, error) {
  18. return marshaler.tracesMarshaler.MarshalTraces(td)
  19. }
  20. func (marshaler *s3Marshaler) MarshalLogs(ld plog.Logs) ([]byte, error) {
  21. return marshaler.logsMarshaler.MarshalLogs(ld)
  22. }
  23. func (marshaler *s3Marshaler) MarshalMetrics(md pmetric.Metrics) ([]byte, error) {
  24. return marshaler.metricsMarshaler.MarshalMetrics(md)
  25. }
  26. func (marshaler *s3Marshaler) format() string {
  27. return marshaler.fileFormat
  28. }