-
Notifications
You must be signed in to change notification settings - Fork 251
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
v1.1.1 prep #901
Closed
Closed
v1.1.1 prep #901
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
38973f9
fix for panic in prometheus.exporter.snmp from the recent version upg…
erikbaranowski f6904bd
Fix panic when component ID contains `/` in `otelcomponent.MustNewTyp…
qclaogui c135502
clean up CHANGELOG
erikbaranowski 4e2800a
Fix staleness during target handover (#703)
thampiotr 55654bb
No error when http fails (#841)
mattdurham df0a27e
fix panic loki source docker (#875)
wildum a3ee0ed
Update version for v1.1.1 in repo
erikbaranowski File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,4 +20,4 @@ | |
# | ||
# Lines starting with "#" and blank lines are ignored. | ||
|
||
v1.1.0 | ||
v1.1.1 | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,7 +4,7 @@ title: Grafana Alloy | |
description: Grafana Alloy is a a vendor-neutral distribution of the OTel Collector | ||
weight: 350 | ||
cascade: | ||
ALLOY_RELEASE: v1.1.0 | ||
ALLOY_RELEASE: v1.1.1 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Updated version for the patch here |
||
OTEL_VERSION: v0.87.0 | ||
FULL_PRODUCT_NAME: Grafana Alloy | ||
PRODUCT_NAME: Alloy | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
package discovery | ||
|
||
import ( | ||
"github.com/grafana/ckit/peer" | ||
"github.com/grafana/ckit/shard" | ||
|
||
"github.com/grafana/alloy/internal/service/cluster" | ||
) | ||
|
||
// DistributedTargets uses the node's Lookup method to distribute discovery | ||
// targets when a component runs in a cluster. | ||
type DistributedTargets struct { | ||
localTargets []Target | ||
// localTargetKeys is used to cache the key hash computation. Improves time performance by ~20%. | ||
localTargetKeys []shard.Key | ||
remoteTargetKeys map[shard.Key]struct{} | ||
} | ||
|
||
// NewDistributedTargets creates the abstraction that allows components to | ||
// dynamically shard targets between components. | ||
func NewDistributedTargets(clusteringEnabled bool, cluster cluster.Cluster, allTargets []Target) *DistributedTargets { | ||
if !clusteringEnabled || cluster == nil { | ||
cluster = disabledCluster{} | ||
} | ||
|
||
localCap := len(allTargets) + 1 | ||
if peerCount := len(cluster.Peers()); peerCount != 0 { | ||
localCap = (len(allTargets) + 1) / peerCount | ||
} | ||
|
||
localTargets := make([]Target, 0, localCap) | ||
localTargetKeys := make([]shard.Key, 0, localCap) | ||
remoteTargetKeys := make(map[shard.Key]struct{}, len(allTargets)-localCap) | ||
|
||
for _, tgt := range allTargets { | ||
targetKey := keyFor(tgt) | ||
peers, err := cluster.Lookup(targetKey, 1, shard.OpReadWrite) | ||
belongsToLocal := err != nil || len(peers) == 0 || peers[0].Self | ||
|
||
if belongsToLocal { | ||
localTargets = append(localTargets, tgt) | ||
localTargetKeys = append(localTargetKeys, targetKey) | ||
} else { | ||
remoteTargetKeys[targetKey] = struct{}{} | ||
} | ||
} | ||
|
||
return &DistributedTargets{ | ||
localTargets: localTargets, | ||
localTargetKeys: localTargetKeys, | ||
remoteTargetKeys: remoteTargetKeys, | ||
} | ||
} | ||
|
||
// LocalTargets returns the targets that belong to the local cluster node. | ||
func (dt *DistributedTargets) LocalTargets() []Target { | ||
return dt.localTargets | ||
} | ||
|
||
// MovedToRemoteInstance returns the set of local targets from prev | ||
// that are no longer local in dt, indicating an active target has moved. | ||
// Only targets which exist in both prev and dt are returned. If prev | ||
// contains an empty list of targets, no targets are returned. | ||
func (dt *DistributedTargets) MovedToRemoteInstance(prev *DistributedTargets) []Target { | ||
if prev == nil { | ||
return nil | ||
} | ||
var movedAwayTargets []Target | ||
for i := 0; i < len(prev.localTargets); i++ { | ||
key := prev.localTargetKeys[i] | ||
if _, exist := dt.remoteTargetKeys[key]; exist { | ||
movedAwayTargets = append(movedAwayTargets, prev.localTargets[i]) | ||
} | ||
} | ||
return movedAwayTargets | ||
} | ||
|
||
func keyFor(tgt Target) shard.Key { | ||
return shard.Key(tgt.NonMetaLabels().Hash()) | ||
} | ||
|
||
type disabledCluster struct{} | ||
|
||
var _ cluster.Cluster = disabledCluster{} | ||
|
||
func (l disabledCluster) Lookup(key shard.Key, replicationFactor int, op shard.Op) ([]peer.Peer, error) { | ||
return nil, nil | ||
} | ||
|
||
func (l disabledCluster) Peers() []peer.Peer { | ||
return nil | ||
} |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated version for the patch here