Skip to content

Commit

Permalink
Move remote write API to client_golang/exp
Browse files Browse the repository at this point in the history
Signed-off-by: Saswata Mukherjee <[email protected]>
  • Loading branch information
saswatamcode committed Jan 17, 2025
1 parent e0800f5 commit d32e301
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 8 deletions.
8 changes: 4 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ fmt: common-format $(GOIMPORTS)
proto: ## Regenerate Go from remote write proto.
proto: $(BUF)
@echo ">> regenerating Prometheus Remote Write proto"
@cd api/prometheus/v1/remote/genproto && $(BUF) generate
@cd api/prometheus/v1/remote && find genproto/ -type f -exec sed -i '' 's/protohelpers "github.com\/planetscale\/vtprotobuf\/protohelpers"/protohelpers "github.com\/prometheus\/client_golang\/internal\/github.com\/planetscale\/vtprotobuf\/protohelpers"/g' {} \;
@cd exp/api/remote/genproto && $(BUF) generate
@cd exp/api/remote && find genproto/ -type f -exec sed -i '' 's/protohelpers "github.com\/planetscale\/vtprotobuf\/protohelpers"/protohelpers "github.com\/prometheus\/client_golang\/internal\/github.com\/planetscale\/vtprotobuf\/protohelpers"/g' {} \;
# For some reasons buf generates this unused import, kill it manually for now and reformat.
@cd api/prometheus/v1/remote && find genproto/ -type f -exec sed -i '' 's/_ "github.com\/gogo\/protobuf\/gogoproto"//g' {} \;
@cd api/prometheus/v1/remote && go fmt ./genproto/...
@cd exp/api/remote && find genproto/ -type f -exec sed -i '' 's/_ "github.com\/gogo\/protobuf\/gogoproto"//g' {} \;
@cd exp/api/remote && go fmt ./genproto/...
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import (
"google.golang.org/protobuf/testing/protocmp"

"github.com/prometheus/client_golang/api"
writev2 "github.com/prometheus/client_golang/api/prometheus/v1/remote/genproto/v2"
writev2 "github.com/prometheus/client_golang/exp/api/remote/genproto/v2"
)

func TestRetryAfterDuration(t *testing.T) {
Expand Down
File renamed without changes.
17 changes: 17 additions & 0 deletions exp/exp.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Copyright 2019 The Prometheus Authors
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

// package exp contains experimental utilities and APIs for Prometheus.
//
// This package is experimental and may contain breaking changes or be removed in the future.
package exp
Original file line number Diff line number Diff line change
Expand Up @@ -5,18 +5,19 @@
package protohelpers

import (
"errors"
"fmt"
"io"
"math/bits"
)

var (
// ErrInvalidLength is returned when decoding a negative length.
ErrInvalidLength = fmt.Errorf("proto: negative length found during unmarshaling")
ErrInvalidLength = errors.New("proto: negative length found during unmarshaling")
// ErrIntOverflow is returned when decoding a varint representation of an integer that overflows 64 bits.
ErrIntOverflow = fmt.Errorf("proto: integer overflow")
ErrIntOverflow = errors.New("proto: integer overflow")
// ErrUnexpectedEndOfGroup is returned when decoding a group end without a corresponding group start.
ErrUnexpectedEndOfGroup = fmt.Errorf("proto: unexpected end of group")
ErrUnexpectedEndOfGroup = errors.New("proto: unexpected end of group")
)

// EncodeVarint encodes a uint64 into a varint-encoded byte slice and returns the offset of the encoded value.
Expand Down

0 comments on commit d32e301

Please sign in to comment.