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

Feature Request: Global Configuration for Scrape Configs #2999

Closed
agolomoodysaada opened this Issue Jul 27, 2017 · 2 comments

Comments

Projects
None yet
2 participants
@agolomoodysaada
Copy link

agolomoodysaada commented Jul 27, 2017

What did you do?
Tried to add azure_sd_configs in global block to reuse in multiple scrape jobs.

What did you expect to see?
It works! I don't have to rewrite all my configurations in every job block.

What did you see instead? Under which circumstances?
Unsupported feature

Environment

  • System information:

    insert output of uname -srm here

  • Prometheus version: 1.7

  • Prometheus configuration file:

Current configuration file

global:
  scrape_interval: 5s

scrape_configs:
  - job_name: <service1>
    azure_sd_configs:
      - subscription_id: <...>
        client_id: <...>
        client_secret: <...>
        tenant_id: <...>
        refresh_interval: <...>
    relabel_configs:
      # ...common relabeling configs
      - source_labels: [__meta_azure_machine_name]
        target_label: instance
      - source_labels: [__meta_azure_machine_resource_group]
        target_label: resource_group
      - source_labels: [__meta_azure_machine_location]
        target_label: location
      # ...specific relabeling configs
      # ...
  - job_name: <service2>
    azure_sd_configs:
      - subscription_id: <...>
        client_id: <...>
        client_secret: <...>
        tenant_id: <...>
        refresh_interval: <...>
    relabel_configs:
      # ...common relabeling configs
      - source_labels: [__meta_azure_machine_name]
        target_label: instance
      - source_labels: [__meta_azure_machine_resource_group]
        target_label: resource_group
      - source_labels: [__meta_azure_machine_location]
        target_label: location
      # ...specific relabeling configs
      # ...
  - job_name: <service3>
    azure_sd_configs:
      - subscription_id: <...>
        client_id: <...>
        client_secret: <...>
        tenant_id: <...>
        refresh_interval: <...>
    relabel_configs:
      # ...common relabeling configs
      - source_labels: [__meta_azure_machine_name]
        target_label: instance
      - source_labels: [__meta_azure_machine_resource_group]
        target_label: resource_group
      - source_labels: [__meta_azure_machine_location]
        target_label: location
      # ...specific relabeling configs
      # ...

Desired configuration file

global:
  scrape_interval: 5s
  scrape_configs:
    - azure_sd_configs:
      - subscription_id: <...>
        client_id: <...>
        client_secret: <...>
        tenant_id: <...>
        refresh_interval: <...>
    - relabel_configs:
    # ...common relabeling configs

scrape_configs:
  - job_name: <service1>
    azure_sd_configs:
      - global.scrape_configs.azure_sd_configs
        # ...specific overrides
        refresh_interval: <...>
    relabel_configs:
      - global.scrape_configs.relabel_configs
        # ...specific overrides
      - source_labels: [__meta_azure_machine_name]
        regex:  'service1.*'
        action: keep
  - job_name: <service2>
    azure_sd_configs:
      - global.scrape_configs.azure_sd_configs
        # ...specific overrides
        refresh_interval: <...>
    relabel_configs:
      - global.scrape_configs.relabel_configs
        # ...specific overrides
      - source_labels: [__meta_azure_machine_name]
        regex:  'service2.*'
        action: keep
  - job_name: <service3>
    azure_sd_configs:
      - global.scrape_configs.azure_sd_configs
        # ...specific overrides
        refresh_interval: <...>
    relabel_configs:
      - global.scrape_configs.relabel_configs
        # ...specific overrides
      - source_labels: [__meta_azure_machine_name]
        regex:  'service3.*'
        action: keep
@brian-brazil

This comment has been minimized.

Copy link
Member

brian-brazil commented Jul 27, 2017

This is something you should handle with configuration management, we do not wish to duplicate such functionality in Prometheus. The feature as-proposed would also be usable only in very very rare circumstances, even for Azure users. It's unusual not to have a mix of SDs.

@lock

This comment has been minimized.

Copy link

lock bot commented Mar 23, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Mar 23, 2019

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
You can’t perform that action at this time.