Skip to content
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

[k159] Remove Prometheus dependency for push pkg #9956

Merged
merged 1 commit into from
Jul 17, 2023

Commits on Jul 17, 2023

  1. Remove Prometheus dependency for push pkg (#9937)

    **What this PR does / why we need it**:
    
    In #9694, we modified the `push` pkg
    to import Prometheus as a dependency to use the `labels.Labels` type for
    the entries' non-indexed labels.
    
    Having Prometheus as a dependency is problematic since any project
    importing the `push` pkg will need to import Prometheus as a result. In
    fact, this is one of the reasons why the `push` pkg was extracted from
    Loki in the first place (#8259).
    
    This PR removes the dependency of Prometheus from the `push` pkg by
    copying some bits of the implementation for Prometheus' `labels.Labels`.
    We copy:
    - The Labels struct definition
    - The JSON Marshaling and Unmarshaling methods for the labels. We need
    this so labels are encoded as maps instead of an array of objects.
    
    ---
    
    **Notes for reviewers:**
    
    - To implement the JSON Marshaling and Unmarshaling methods the `push`
    pkg now depends on `golang.org/x/exp`. I think it should be fine for
    projects importing the `push` pkg to also depend on `golang.org/x/exp`,
    right?
    
    (cherry picked from commit 15af77b)
    salvacorts authored and grafana-delivery-bot[bot] committed Jul 17, 2023
    Configuration menu
    Copy the full SHA
    3e1441b View commit details
    Browse the repository at this point in the history