All Downloads are FREE. Search and download functionalities are using the official Maven repository.

zipkin2.reporter.brave.ZipkinProto3Encoder Maven / Gradle / Ivy

The newest version!
/*
 * Copyright The OpenZipkin Authors
 * SPDX-License-Identifier: Apache-2.0
 */
package zipkin2.reporter.brave;

import brave.Tag;
import brave.Tags;
import brave.handler.MutableSpan;
import zipkin2.reporter.BytesEncoder;
import zipkin2.reporter.Encoding;
import zipkin2.reporter.brave.internal.ZipkinProto3Writer;

final class ZipkinProto3Encoder implements BytesEncoder {
  static final BytesEncoder INSTANCE = new ZipkinProto3Encoder(Tags.ERROR);
  final ZipkinProto3Writer delegate;

  ZipkinProto3Encoder(Tag errorTag) {
    if (errorTag == null) throw new NullPointerException("errorTag == null");
    this.delegate = new ZipkinProto3Writer(errorTag);
  }

  @Override public Encoding encoding() {
    return Encoding.PROTO3;
  }

  @Override public int sizeInBytes(MutableSpan span) {
    return delegate.sizeInBytes(span);
  }

  @Override public byte[] encode(MutableSpan span) {
    return delegate.write(span);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy