Skip to content

Commit

Permalink
Update OTLP to v0.4.0 [Breaking change] (#1142)
Browse files Browse the repository at this point in the history
This is a breaking OTLP change.

- Use AnyValue introduced in recent change to OTLP.
  Changes are encapsulated in AttributeValue and most of the codebase is
  unaffected, which proves the wrappers are very useful.

- Rename AttributeKeyValue to KeyValue (the change comes from OTLP).

- Use local protoc to compile ProtoBufs. Previously used znly/protoc
  docker image is outdated and results in incorrect code for gRPC-Gateway.

TODO:

- Need to add support for ARRAY value type. This is not urgent since
  there are no known data sources that use the ARRAY type yet.

- Use Gogoproto `(gogoproto.nullable) = false` annotation for AnyValue
  to possibly improve performance further.
  • Loading branch information
tigrannajaryan committed Jun 25, 2020
1 parent c8b812b commit 4777e91
Show file tree
Hide file tree
Showing 27 changed files with 5,086 additions and 2,746 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ genproto_sub:
$(foreach file,$(OPENTELEMETRY_PROTO_FILES),$(call exec-command,sed 's+github.com/open-telemetry/opentelemetry-proto/gen/go/+go.opentelemetry.io/collector/internal/data/opentelemetry-proto-gen/+g' $(OPENTELEMETRY_PROTO_SRC_DIR)/$(file) > $(PROTO_INTERMEDIATE_DIR)/$(file)))

@echo Generate Go code from Logs .proto files in intermediate directory.
$(foreach file,$(LOGS_PROTO_FILES),$(call exec-command,docker run --rm -v $(PWD)/$(LOGS_PROTO_SRC_DIR):$(PWD)/$(LOGS_PROTO_SRC_DIR) -v $(PWD)/$(PROTO_INTERMEDIATE_DIR):$(PWD)/$(PROTO_INTERMEDIATE_DIR) -w $(PWD)/$(LOGS_PROTO_SRC_DIR) znly/protoc --gogofaster_out=plugins=grpc:./ -I./ -I$(PWD)/$(PROTO_INTERMEDIATE_DIR) $(file)))
$(foreach file,$(LOGS_PROTO_FILES),$(call exec-command,cd $(LOGS_PROTO_SRC_DIR) && protoc --gogofaster_out=plugins=grpc:./ -I./ -I$(PWD)/$(PROTO_INTERMEDIATE_DIR) $(file)))

@echo Move generated code to target directory.
mkdir -p $(PROTO_TARGET_GEN_DIR)
cp -R $(LOGS_PROTO_SRC_DIR)/$(PROTO_PACKAGE)/* $(PROTO_TARGET_GEN_DIR)/
rm -rf $(LOGS_PROTO_SRC_DIR)/go.opentelemetry.io

@echo Generate Go code from .proto files in intermediate directory.
$(foreach file,$(OPENTELEMETRY_PROTO_FILES),$(call exec-command,docker run --rm -v $(PWD)/$(PROTO_INTERMEDIATE_DIR):$(PWD)/$(PROTO_INTERMEDIATE_DIR) -w $(PWD)/$(PROTO_INTERMEDIATE_DIR) znly/protoc --gogofaster_out=plugins=grpc:./ -I./ $(file)))
$(foreach file,$(OPENTELEMETRY_PROTO_FILES),$(call exec-command,cd $(PROTO_INTERMEDIATE_DIR) && protoc --gogofaster_out=plugins=grpc:./ -I./ $(file)))

@echo Generate gRPC gateway code.
cd $(PROTO_INTERMEDIATE_DIR) && protoc --grpc-gateway_out=logtostderr=true,grpc_api_configuration=opentelemetry/proto/collector/trace/v1/trace_service_http.yaml:./ opentelemetry/proto/collector/trace/v1/trace_service.proto
Expand Down
4 changes: 2 additions & 2 deletions cmd/pdatagen/internal/metrics_structs.go
Original file line number Diff line number Diff line change
Expand Up @@ -152,8 +152,8 @@ var metricDescriptor = &messageStruct{
originFieldName: "Type",
returnType: "MetricType",
rawType: "otlpmetrics.MetricDescriptor_Type",
defaultVal: "MetricTypeUnspecified",
testVal: "MetricTypeGaugeInt64",
defaultVal: "MetricTypeInvalid",
testVal: "MetricTypeInt64",
},
},
}
Expand Down
Loading

0 comments on commit 4777e91

Please sign in to comment.