Description: Support building against golang-goprotobuf-dev < v1.4.0
 Starting with version 1.4.0 of github.com/golang/protobuf, timestamp.Timestamp
 is a type alias of timestamppb.Timestamp from google.golang.org/protobuf
 (packaged in Debian as golang-google-protobuf-dev). This patch applies the
 necessary workarounds to build against golang-github-golang-protobuf-1-3-dev.
 Despite golang-github-golang-protobuf-1-5-dev also now existing in sid, it
 mutually conflicts with golang-github-golang-protobuf-1-3-dev, and since
 golang-github-prometheus-client-golang and golang-github-prometheus-common
 cyclically depend on each other, this currently creates a stalemate situation.
Author: Daniel Swarbrick <dswarbrick@debian.org>
Forwarded: not-needed
Last-Update: 2022-09-16
--- a/prometheus/value.go
+++ b/prometheus/value.go
@@ -21,6 +21,7 @@ import (
 
 	//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
 	"github.com/golang/protobuf/proto"
+	"github.com/golang/protobuf/ptypes/timestamp"
 	"google.golang.org/protobuf/types/known/timestamppb"
 
 	"github.com/prometheus/client_golang/prometheus/internal"
@@ -212,7 +213,7 @@ func newExemplar(value float64, ts time.
 	if err := tsProto.CheckValid(); err != nil {
 		return nil, err
 	}
-	e.Timestamp = tsProto
+	e.Timestamp = &timestamp.Timestamp{Seconds: tsProto.GetSeconds(), Nanos: tsProto.GetNanos()}
 	labelPairs := make([]*dto.LabelPair, 0, len(l))
 	var runes int
 	for name, value := range l {
--- a/prometheus/counter_test.go
+++ b/prometheus/counter_test.go
@@ -22,6 +22,7 @@ import (
 
 	//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
 	"github.com/golang/protobuf/proto"
+	"github.com/golang/protobuf/ptypes/timestamp"
 	"google.golang.org/protobuf/types/known/timestamppb"
 
 	dto "github.com/prometheus/client_model/go"
@@ -235,7 +236,7 @@ func TestCounterExemplar(t *testing.T) {
 			{Name: proto.String("foo"), Value: proto.String("bar")},
 		},
 		Value:     proto.Float64(42),
-		Timestamp: ts,
+		Timestamp: &timestamp.Timestamp{Seconds: ts.GetSeconds(), Nanos: ts.GetNanos()},
 	}
 
 	counter.AddWithExemplar(42, Labels{"foo": "bar"})
--- a/prometheus/histogram_test.go
+++ b/prometheus/histogram_test.go
@@ -27,6 +27,7 @@ import (
 
 	//nolint:staticcheck // Ignore SA1019. Need to keep deprecated package for compatibility.
 	"github.com/golang/protobuf/proto"
+	"github.com/golang/protobuf/ptypes/timestamp"
 	"google.golang.org/protobuf/types/known/timestamppb"
 
 	"github.com/prometheus/client_golang/prometheus/internal"
@@ -432,7 +433,7 @@ func TestHistogramExemplar(t *testing.T)
 				{Name: proto.String("id"), Value: proto.String("2")},
 			},
 			Value:     proto.Float64(1.6),
-			Timestamp: ts,
+			Timestamp: &timestamp.Timestamp{Seconds: ts.GetSeconds(), Nanos: ts.GetNanos()},
 		},
 		nil,
 		{
@@ -440,14 +441,14 @@ func TestHistogramExemplar(t *testing.T)
 				{Name: proto.String("id"), Value: proto.String("3")},
 			},
 			Value:     proto.Float64(4),
-			Timestamp: ts,
+			Timestamp: &timestamp.Timestamp{Seconds: ts.GetSeconds(), Nanos: ts.GetNanos()},
 		},
 		{
 			Label: []*dto.LabelPair{
 				{Name: proto.String("id"), Value: proto.String("4")},
 			},
 			Value:     proto.Float64(4.5),
-			Timestamp: ts,
+			Timestamp: &timestamp.Timestamp{Seconds: ts.GetSeconds(), Nanos: ts.GetNanos()},
 		},
 	}
 
