Skip to content

Commit

Permalink
ref: Remove metrics for internal project ids (getsentry#1054)
Browse files Browse the repository at this point in the history
  • Loading branch information
jan-auer authored Aug 4, 2021
1 parent 21d62cc commit 7bf6b03
Show file tree
Hide file tree
Showing 4 changed files with 3 additions and 48 deletions.
11 changes: 1 addition & 10 deletions relay-config/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ use failure::{Backtrace, Context, Fail};
use serde::{de::DeserializeOwned, Deserialize, Deserializer, Serialize, Serializer};

use relay_auth::{generate_key_pair, generate_relay_id, PublicKey, RelayId, SecretKey};
use relay_common::{ProjectId, Uuid};
use relay_common::Uuid;
use relay_metrics::AggregatorConfig;
use relay_redis::RedisConfig;

Expand Down Expand Up @@ -771,9 +771,6 @@ pub struct Processing {
/// Maximum rate limit to report to clients.
#[serde(default = "default_max_rate_limit")]
pub max_rate_limit: Option<u32>,
/// Projects for which to emit extra (high-noise) metrics.
#[serde(default)]
pub _internal_projects: Vec<ProjectId>,
}

impl Default for Processing {
Expand All @@ -791,7 +788,6 @@ impl Default for Processing {
attachment_chunk_size: default_chunk_size(),
projectconfig_cache_prefix: default_projectconfig_cache_prefix(),
max_rate_limit: default_max_rate_limit(),
_internal_projects: Vec::new(),
}
}
}
Expand Down Expand Up @@ -1507,11 +1503,6 @@ impl Config {
self.values.processing.enabled
}

/// Set of internal project IDs for which to emit extra metrics.
pub fn processing_internal_projects(&self) -> &[ProjectId] {
&self.values.processing._internal_projects
}

/// The path to the GeoIp database required for event processing.
pub fn geoip_path(&self) -> Option<&Path> {
self.values.processing.geoip_path.as_deref()
Expand Down
13 changes: 0 additions & 13 deletions relay-server/src/actors/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -659,19 +659,6 @@ impl Handler<StoreEnvelope> for StoreForwarder {
attachments,
});

#[cfg(feature = "processing")]
if self
.config
.processing_internal_projects()
.contains(&scoping.project_id)
{
metric!(
counter(RelayCounters::InternalCapturedEventStoreActor) += 1,
event_item_type = &event_item.ty().to_string(),
project = &scoping.project_id.value().to_string(),
);
}

self.produce(topic, event_message)?;
metric!(
counter(RelayCounters::ProcessingMessageProduced) += 1,
Expand Down
18 changes: 2 additions & 16 deletions relay-server/src/endpoints/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use failure::Fail;
use futures::prelude::*;
use serde::Deserialize;

use relay_common::{clone, metric, tryf, DataCategory, ProjectId};
use relay_common::{clone, metric, tryf};
use relay_config::Config;
use relay_general::protocol::{EventId, EventType};
use relay_log::LogError;
Expand All @@ -28,9 +28,7 @@ use crate::envelope::{AttachmentType, Envelope, EnvelopeError, ItemType, Items};
use crate::extractors::RequestMeta;
use crate::metrics::RelayCounters;
use crate::service::{ServiceApp, ServiceState};
use crate::utils::{
self, ApiErrorResponse, EnvelopeSummary, FormDataIter, MultipartError, SendWithOutcome,
};
use crate::utils::{self, ApiErrorResponse, FormDataIter, MultipartError, SendWithOutcome};

#[derive(Fail, Debug)]
pub enum BadStoreRequest {
Expand Down Expand Up @@ -398,26 +396,14 @@ where

let project_key = meta.public_key();
let start_time = meta.start_time();
let project_id = meta.project_id().unwrap_or_else(|| ProjectId::new(0));

let config = request.state().config();
let processing_enabled = config.processing_enabled();
let is_internal = config.processing_internal_projects().contains(&project_id);

let envelope_context = Rc::new(RefCell::new(EnvelopeContext::from_request(&meta)));

let future = extract_envelope(&request, meta)
.into_future()
.and_then(clone!(envelope_context, |envelope| {
let summary = EnvelopeSummary::compute(&envelope);

if is_internal && summary.event_category == Some(DataCategory::Transaction) {
metric!(
counter(RelayCounters::InternalCapturedEventEndpoint) += 1,
project = &project_id.to_string()
);
}

envelope_context.borrow_mut().update(&envelope);
if envelope.is_empty() {
// envelope is empty, cannot send outcomes
Expand Down
9 changes: 0 additions & 9 deletions relay-server/src/metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -431,12 +431,6 @@ pub enum RelayCounters {
/// be used to ingest events. Once the grace period expires, the cache is evicted and new
/// requests wait for an update.
EvictingStaleProjectCaches,
/// An event has been produced to Kafka for one of the configured "internal" projects.
#[cfg(feature = "processing")]
InternalCapturedEventStoreActor,
/// An event has been preliminarily accepted in the store endpoint for one of the configured
/// "internal" projects.
InternalCapturedEventEndpoint,
}

impl CounterMetric for RelayCounters {
Expand All @@ -462,9 +456,6 @@ impl CounterMetric for RelayCounters {
RelayCounters::Requests => "requests",
RelayCounters::ResponsesStatusCodes => "responses.status_codes",
RelayCounters::EvictingStaleProjectCaches => "project_cache.eviction",
#[cfg(feature = "processing")]
RelayCounters::InternalCapturedEventStoreActor => "internal.captured.event.store_actor",
RelayCounters::InternalCapturedEventEndpoint => "internal.captured.event.endpoint",
}
}
}

0 comments on commit 7bf6b03

Please sign in to comment.