如何在普罗米修斯中删除除白名单之外的所有指标?

时间:2018-04-30 22:03:38

标签: prometheus

我试图删除prometheus中除了一些列入白名单的指标。我可以选择性地坚持他们:

  metric_relabel_configs:
  - source_labels: [__name__]
    regex: (?i)(metric1|metric2|metric3)
    action: keep

但是我想删除所有其他不匹配的指标。有没有直截了当的方法呢?

1 个答案:

答案 0 :(得分:5)

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_coin_detail); sectionsPagerAdapter = new SectionsPagerAdapter(getSupportFragmentManager()); viewPager = (ViewPager) findViewById(R.id.graph_container); setupViewPager(viewPager); viewPager.setOffscreenPageLimit(10); TabLayout tabLayout = (TabLayout) findViewById(R.id.tabs); tabLayout.setupWithViewPager(viewPager); tabLayout.getTabAt(0).setText("1 Day"); tabLayout.getTabAt(1).setText("7 Days"); tabLayout.getTabAt(2).setText("30 Days"); TextView header = findViewById(R.id.newtextViewHead); coinIMG = (ImageView) findViewById(R.id.imageView2); button_alert = (CircleButton) findViewById(R.id.button); button_fav = (CircleButton) findViewById(R.id.button_favorite); //Calls for intent Intent intent = getIntent(); //Tabs for fragment private void setupViewPager(ViewPager viewPager){ SectionsPagerAdapter adapter = new SectionsPagerAdapter(getSupportFragmentManager()); adapter.addFragment(new Fragment_Graph1()); adapter.addFragment(new Fragment_Graph2()); adapter.addFragment(new Fragment_Graph3()); viewPager.setAdapter(adapter); } 动作会删除所有不匹配的内容,因此单个操作足以执行您想要的操作。