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

[exporter/loki] Make optional default labels exporter, job, instance, level #22156

Closed
mar4uk opened this issue May 22, 2023 · 3 comments
Closed
Labels
enhancement New feature or request exporter/loki Loki Exporter

Comments

@mar4uk
Copy link
Contributor

mar4uk commented May 22, 2023

Component(s)

exporter/loki

Is your feature request related to a problem? Please describe.

Currently, loki exporter sets default labels:

  • exporter=OTLP
  • job=service.namespace/service.name
  • instance=service.instance.id
  • level=severity

For the user's convenience, it would be nice to make these labels optional

Related issues/discussions:

Describe the solution you'd like

  1. I would reconsider setting level label by default (it is actually not a good practice to promote log level to the label in Loki)
  2. I would add default_labels section to the loki exporter config:
loki:
      endpoint: ...
      default_labels:
           job: false
           instance: false
           exporter: false

Describe alternatives you've considered

No response

Additional context

No response

@mar4uk mar4uk added enhancement New feature or request needs triage New item requiring triage labels May 22, 2023
@mar4uk
Copy link
Contributor Author

mar4uk commented May 22, 2023

/label exporter/loki

@github-actions github-actions bot added the exporter/loki Loki Exporter label May 22, 2023
@gillg
Copy link
Contributor

gillg commented May 22, 2023

Thanks for taking care of this !

In my opinion, the hardcoded value OTLP should be renamed OpenTelemetry Collector or OtelCollector to make more sense.

@jpkrohling
Copy link
Member

the hardcoded value OTLP should be renamed

Perhaps there should be an option to name it differently, but not a total rename right now. We'd need to give users notice in advance about this change.

jpkrohling pushed a commit that referenced this issue Jul 27, 2023
)

**Description:** <Describe what has changed.>
Added new setting `default_labels_enabled` into the loki exporter
config.
When this setting is passed loki exporter will not set default labels if
the setting value is false, for example:

```
loki:
  endpoint: ...
  default_labels_enabled:
    job: true
    instance: false
    exporter: false
    level: false
```
In this example, only the `job` label will be added, `instance`,
`exporter`, and `level` will not be added as Loki labels.

If `default_labels_enabled` is omitted the current behavior will be
applied: default labels will be added (exporter, job, instance, label)
If one of the labels is omitted in `default_labels_enabled` then the
current behavior will be applied: this label will be added

**Link to tracking Issue:**
#22156

**Testing:** unit tests added

**Documentation:** README updated
@mar4uk mar4uk closed this as completed Jul 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request exporter/loki Loki Exporter
Projects
None yet
Development

No branches or pull requests

3 participants