Include generated Protocol Buffer descriptor.

The Protocol Buffer compiler supports generating a machine-readable
descriptor file encoded as a provided Protocol Buffer message type,
which can be used to decode messages that have been encoded with it
after-the-fact.  The generated descriptor also bundles in dependent
message types.

We can use this to perform forensics on old Prometheus clients, if
necessary.
This commit is contained in:
Matt T. Proud 2013-04-24 16:59:40 +02:00
parent af7ddc36e2
commit 9e02c2393a
5 changed files with 23 additions and 10 deletions

View file

@ -76,7 +76,7 @@ test: build
go test ./utility/... $(GO_TEST_FLAGS)
go test ./web/... $(GO_TEST_FLAGS)
web: preparation
web: preparation model
$(MAKE) -C web
.PHONY: advice binary build clean documentation format model package preparation run search_index source_path test

View file

@ -11,14 +11,18 @@
# See the License for the specific language governing permissions and
# limitations under the License.
all: generated
SUFFIXES:
MAKE_ARTIFACTS = generated-stamp
all: generated
include ../Makefile.INCLUDE
generated: generated-stamp
generated-stamp: data.proto
protoc --go_out=generated/ data.proto
protoc --proto_path=$(PREFIX)/include:. --go_out=generated/ --descriptor_set_out=generated/descriptor.blob data.proto
touch $@
clean:

View file

@ -11,7 +11,9 @@
// See the License for the specific language governing permissions and
// limitations under the License.
package dto;
package io.prometheus;
import "google/protobuf/descriptor.proto";
message LabelPair {
optional string name = 1;

View file

@ -1,4 +1,2 @@
*.cc
*.go
*.h
*.o
data.pb.go
descriptor.blob

View file

@ -13,10 +13,19 @@
all: files.go
files.go: $(shell find ../templates/ ../static/ -type f)
../../utility/embed-static.sh ../static ../templates | gofmt > $@
SUFFIXES:
generated:
mkdir -vp generated
generated/protocol_buffer.descriptor: generated ../../model/generated/descriptor.blob
cp ../../model/generated/descriptor.blob -f $@
files.go: $(shell find ../templates/ ../static/ -type f) generated/protocol_buffer.descriptor
../../utility/embed-static.sh ../static ../templates ./generated | gofmt > $@
clean:
-rm files.go
-rm -rf generated
.PHONY: clean