github.com/thanos-io/thanos@v0.32.5/pkg/targets/targetspb/rpc.proto (about) 1 // Copyright (c) The Thanos Authors. 2 // Licensed under the Apache License 2.0. 3 4 syntax = "proto3"; 5 package thanos; 6 7 import "store/storepb/types.proto"; 8 import "gogoproto/gogo.proto"; 9 import "store/labelpb/types.proto"; 10 import "google/protobuf/timestamp.proto"; 11 12 option go_package = "targetspb"; 13 14 option (gogoproto.sizer_all) = true; 15 option (gogoproto.marshaler_all) = true; 16 option (gogoproto.unmarshaler_all) = true; 17 option (gogoproto.goproto_getters_all) = false; 18 19 // Do not generate XXX fields to reduce memory footprint and opening a door 20 // for zero-copy casts to/from prometheus data types. 21 option (gogoproto.goproto_unkeyed_all) = false; 22 option (gogoproto.goproto_unrecognized_all) = false; 23 option (gogoproto.goproto_sizecache_all) = false; 24 25 /// Targets represents API that is responsible for gathering targets and their states. 26 service Targets { 27 /// Targets has info for all targets. 28 /// Returned targets are expected to include external labels. 29 rpc Targets (TargetsRequest) returns (stream TargetsResponse); 30 } 31 32 message TargetsRequest { 33 enum State { 34 ANY = 0; 35 /// This will make sure strings.ToLower(.String()) will match 'active' and 'dropped' values for 36 /// Prometheus HTTP API. 37 ACTIVE = 1; 38 DROPPED = 2; 39 } 40 State state = 1; 41 PartialResponseStrategy partial_response_strategy = 2; 42 } 43 44 message TargetsResponse { 45 oneof result { 46 /// structure with targets. It is up to server implementation to decide how many of those to put here within single frame. 47 TargetDiscovery targets = 1; 48 49 /// warning is considered an information piece in place of series for warning purposes. 50 /// It is used to warn rule API users about suspicious cases or partial response (if enabled). 51 string warning = 2; 52 } 53 } 54 55 message TargetDiscovery { 56 repeated ActiveTarget activeTargets = 1 [(gogoproto.jsontag) = "activeTargets"]; 57 repeated DroppedTarget droppedTargets = 2 [(gogoproto.jsontag) = "droppedTargets"]; 58 } 59 60 enum TargetHealth { 61 DOWN = 0; 62 UP = 1; 63 } 64 65 message ActiveTarget { 66 ZLabelSet discoveredLabels = 1 [(gogoproto.jsontag) = "discoveredLabels", (gogoproto.nullable) = false]; 67 ZLabelSet labels = 2 [(gogoproto.jsontag) = "labels", (gogoproto.nullable) = false]; 68 string scrapePool = 3 [(gogoproto.jsontag) = "scrapePool"]; 69 string scrapeUrl = 4 [(gogoproto.jsontag) = "scrapeUrl"]; 70 string globalUrl = 5 [(gogoproto.jsontag) = "globalUrl"]; 71 string lastError = 6 [(gogoproto.jsontag) = "lastError"]; 72 google.protobuf.Timestamp lastScrape = 7 [(gogoproto.jsontag) = "lastScrape", (gogoproto.stdtime) = true, (gogoproto.nullable) = false]; 73 double lastScrapeDuration = 8 [(gogoproto.jsontag) = "lastScrapeDuration"]; 74 TargetHealth health = 9 [(gogoproto.jsontag) = "health"]; 75 } 76 77 message DroppedTarget { 78 ZLabelSet discoveredLabels = 1 [(gogoproto.jsontag) = "discoveredLabels", (gogoproto.nullable) = false]; 79 }