From 1648cf3ff58af20e7721c0e95b226c4f3336dee9 Mon Sep 17 00:00:00 2001 From: Alex Boten Date: Sun, 13 Mar 2022 08:48:24 -0700 Subject: [PATCH] Add field of present flag to proto build (#366) * Add field presence flag to proto build. * Fix #314 - Cannot distinguish between sum being 0 and undefined. * remove gogo from Makefile Co-authored-by: Josh Suereth --- Makefile | 3 +-- opentelemetry/proto/metrics/v1/metrics.proto | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/Makefile b/Makefile index 9e367730f..54c234d52 100755 --- a/Makefile +++ b/Makefile @@ -19,7 +19,6 @@ gen-all: gen-cpp gen-csharp gen-go gen-java gen-kotlin gen-objc gen-openapi gen- OTEL_DOCKER_PROTOBUF ?= otel/build-protobuf:0.9.0 PROTOC := docker run --rm -u ${shell id -u} -v${PWD}:${PWD} -w${PWD} ${OTEL_DOCKER_PROTOBUF} --proto_path=${PWD} -PROTO_INCLUDES := -I/usr/include/github.com/gogo/protobuf PROTO_GEN_CPP_DIR ?= $(GENDIR)/cpp PROTO_GEN_CSHARP_DIR ?= $(GENDIR)/csharp @@ -63,7 +62,7 @@ gen-csharp: gen-go: rm -rf ./$(PROTO_GEN_GO_DIR) mkdir -p ./$(PROTO_GEN_GO_DIR) - $(foreach file,$(PROTO_FILES),$(call exec-command,$(PROTOC) $(PROTO_INCLUDES) --gogo_out=plugins=grpc:./$(PROTO_GEN_GO_DIR) $(file))) + $(foreach file,$(PROTO_FILES),$(call exec-command,$(PROTOC) --go_out=plugins=grpc:./$(PROTO_GEN_GO_DIR) $(file))) $(PROTOC) --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:./$(PROTO_GEN_GO_DIR) opentelemetry/proto/collector/trace/v1/trace_service.proto $(PROTOC) --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/metrics/v1/metrics_service_http.yaml:./$(PROTO_GEN_GO_DIR) opentelemetry/proto/collector/metrics/v1/metrics_service.proto $(PROTOC) --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/logs/v1/logs_service_http.yaml:./$(PROTO_GEN_GO_DIR) opentelemetry/proto/collector/logs/v1/logs_service.proto diff --git a/opentelemetry/proto/metrics/v1/metrics.proto b/opentelemetry/proto/metrics/v1/metrics.proto index 46c155fe2..5256b7390 100644 --- a/opentelemetry/proto/metrics/v1/metrics.proto +++ b/opentelemetry/proto/metrics/v1/metrics.proto @@ -459,7 +459,7 @@ message HistogramDataPoint { // Negative events *can* be recorded, but sum should not be filled out when // doing so. This is specifically to enforce compatibility w/ OpenMetrics, // see: https://github.com/OpenObservability/OpenMetrics/blob/main/specification/OpenMetrics.md#histogram - double sum = 5; + optional double sum = 5; // bucket_counts is an optional field contains the count values of histogram // for each bucket.