This repository was archived by the owner on Apr 30, 2025. It is now read-only.
  
  
  
            
  
    
      forked from cortexproject/cortex
    
        
        - 
                Notifications
    You must be signed in to change notification settings 
- Fork 9
Extract ipAddress from context #26
          
     Open
      
      
            MichelHollands
  wants to merge
  21
  commits into
  grafana:master
  
    
      
        
          
  
    
      Choose a base branch
      
     
    
      
        
      
      
        
          
          
        
        
          
            
              
              
              
  
           
        
        
          
            
              
              
           
        
       
     
  
        
          
            
          
            
          
        
       
    
      
from
MichelHollands:add_client_ip_address_to_duplicate_message
  
      
      
   
  
    
  
  
  
 
  
      
    base: master
Could not load branches
            
              
  
    Branch not found: {{ refName }}
  
            
                
      Loading
              
            Could not load tags
            
            
              Nothing to show
            
              
  
            
                
      Loading
              
            Are you sure you want to change the base?
            Some commits from the old base branch may be removed from the timeline,
            and old review comments may become outdated.
          
          
                
     Open
            
            Extract ipAddress from context #26
                    MichelHollands
  wants to merge
  21
  commits into
  grafana:master
from
MichelHollands:add_client_ip_address_to_duplicate_message
  
      
      
   
              
            Conversation
  
    
      This file contains hidden or 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
    
  
  
    
    Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
3c96cb7    to
    902f74e      
    Compare
  
    Signed-off-by: Michel Hollands <[email protected]>
e442223    to
    e1b3b82      
    Compare
  
    Signed-off-by: Michel Hollands <[email protected]>
37cb26b    to
    ec93caf      
    Compare
  
    Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
3d2cea3    to
    6e99d01      
    Compare
  
    Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Michel Hollands <[email protected]>
Signed-off-by: Marco Pracucci <[email protected]>
| 
 | 
  
      Sign up for free
      to subscribe to this conversation on GitHub.
      Already have an account?
      Sign in.
  
      
  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.
  
    
  
    
What this PR does:
Extract the IP address from the X-Forwarder-For value in the context. Add it to the duplicate samples error message. The error message now looks like this:
The fact that the IP addresses look like '1.2.3.4, ::1, ::1' is a result of the proxy I'm using. Prometheus remote writes to a reverse proxy which forwards the remote write to Cortex. Prometheus, the reverse proxy and Cortex are running locally on a Mac hence the ::1 IP v6 address. The reverse proxy adds the X-Forwarded-For header of 1.2.3.4. This reverse proxy uses the Go httputil.ReverseProxy type which automatically adds the IP address of it's client (Prometheus) as well. So X-Forwarded-For = "1.2.3.4, ::1" coming into Cortex. The last ::1 is then the remote address of the proxy.
Checklist
CHANGELOG.mdupdated - the order of entries should be[CHANGE],[FEATURE],[ENHANCEMENT],[BUGFIX]