All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.spotify.apollo.httpservice.MetricIdModule Maven / Gradle / Ivy

There is a newer version: 1.15.8
Show newest version
/*
 * -\-\-
 * Spotify Apollo HTTP Service
 * --
 * Copyright (C) 2013 - 2016 Spotify AB
 * --
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * -/-/-
 */
/*
 * Copyright (c) 2015 Spotify AB
 */

package com.spotify.apollo.httpservice;

import com.google.inject.Provides;

import com.spotify.apollo.meta.MetaDescriptor;
import com.spotify.apollo.module.AbstractApolloModule;
import com.spotify.metrics.core.MetricId;

import javax.inject.Singleton;

class MetricIdModule extends AbstractApolloModule {

  private MetricIdModule() {
  }

  static MetricIdModule create() {
    return new MetricIdModule();
  }

  @Override
  protected void configure() {
    requireBinding(MetaDescriptor.class);
  }

  @Provides
  @Singleton
  public MetricId metricId(MetaDescriptor metaDescriptor) {
    return MetricId.build("apollo").tagged(
        "service-framework", "http-service",
        "service-framework-version", metaDescriptor.apolloVersion(),
        "application", metaDescriptor.descriptor().serviceName(),
        "application-version", metaDescriptor.descriptor().version());
  }

  @Override
  public String getId() {
    return "http-service-metric-id";
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy