Skip to content

Commit

Permalink
Merge branch 'master' into riccardo/feat/cross-stacks-spooling
Browse files Browse the repository at this point in the history
  • Loading branch information
iambriccardo committed Oct 8, 2024
2 parents ace9fcc + 52bc345 commit 45a33a2
Show file tree
Hide file tree
Showing 28 changed files with 280 additions and 381 deletions.
24 changes: 6 additions & 18 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -365,27 +365,21 @@ jobs:
REVISION: "${{ github.event.pull_request.head.sha || github.sha }}"

steps:
- name: Install cosign
uses: sigstore/cosign-installer@v3.6.0

- name: Install regctl
uses: regclient/actions/regctl-installer@2dac4eff5925ed07edbfe12d2d11af6304df29a6

- name: Login to DockerHub
run: docker login --username=sentrybuilder --password ${{ secrets.DOCKER_HUB_RW_TOKEN }}

- name: Copy Image from GHCR to DockerHub
run: |
# We push 3 tags to Dockerhub:
# 1) the full sha of the commit
regctl image copy "${GHCR_DOCKER_IMAGE}:${REVISION}" "${DH_DOCKER_IMAGE}:${REVISION}"
docker buildx imagetools create --tag "${DH_DOCKER_IMAGE}:${REVISION}" "${GHCR_DOCKER_IMAGE}:${REVISION}"
# 2) the short sha
SHORT_SHA=$(echo ${GITHUB_SHA} | cut -c1-8)
regctl image copy "${GHCR_DOCKER_IMAGE}:${REVISION}" "${DH_DOCKER_IMAGE}:${SHORT_SHA}"
docker buildx imagetools create --tag "${DH_DOCKER_IMAGE}:${SHORT_SHA}" "${GHCR_DOCKER_IMAGE}:${REVISION}"
# 3) nightly
regctl image copy "${GHCR_DOCKER_IMAGE}:nightly" "${DH_DOCKER_IMAGE}:nightly"
docker buildx imagetools create --tag "${DH_DOCKER_IMAGE}:nightly" "${GHCR_DOCKER_IMAGE}:${REVISION}"
publish-to-gcr:
timeout-minutes: 5
Expand Down Expand Up @@ -413,9 +407,6 @@ jobs:
if: "!startsWith(github.ref, 'refs/heads/release-library/') && !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' && needs.build-setup.outputs.full_ci == 'true'"

steps:
- name: Install cosign
uses: sigstore/cosign-installer@v3.6.0

- name: Google Auth
id: auth
uses: google-github-actions/auth@v2
Expand All @@ -434,15 +425,12 @@ jobs:
run: |
gcloud auth configure-docker us-central1-docker.pkg.dev
- name: Install regctl
uses: regclient/actions/regctl-installer@2dac4eff5925ed07edbfe12d2d11af6304df29a6

- name: Copy Image from GHCR to AR
run: regctl image copy "${GHCR_DOCKER_IMAGE}:${REVISION}" "${AR_DOCKER_IMAGE}:${REVISION}"
run: docker buildx imagetools create --tag "${AR_DOCKER_IMAGE}:${REVISION}" "${GHCR_DOCKER_IMAGE}:${REVISION}"

- name: Copy Nightly from GHCR to AR
if: github.ref == 'refs/heads/master'
run: regctl image copy "${GHCR_DOCKER_IMAGE}:nightly" "${AR_DOCKER_IMAGE}:nightly"
run: docker buildx imagetools create --tag "${AR_DOCKER_IMAGE}:nightly" "${GHCR_DOCKER_IMAGE}:nightly"

gocd-artifacts:
timeout-minutes: 5
Expand Down Expand Up @@ -508,7 +496,7 @@ jobs:
test_integration:
name: Integration Tests
runs-on: ubuntu-latest
timeout-minutes: 20
timeout-minutes: 30

# Skip redundant checks for library releases
if: "!startsWith(github.ref, 'refs/heads/release-library/')"
Expand Down
1 change: 0 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
- Use custom wildcard matching instead of regular expressions. ([#4073](https://github.com/getsentry/relay/pull/4073))
- Allowlist the SentryUptimeBot user-agent. ([#4068](https://github.com/getsentry/relay/pull/4068))
- Feature flags of graduated features are now hard-coded in Relay so they can be removed from Sentry. ([#4076](https://github.com/getsentry/relay/pull/4076), [#4080](https://github.com/getsentry/relay/pull/4080))
- Prevent span extraction when quota is active to reduce load on redis. ([#4097](https://github.com/getsentry/relay/pull/4097))

## 24.9.0

Expand Down
22 changes: 0 additions & 22 deletions relay-server/src/envelope.rs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,6 @@ use smallvec::SmallVec;

use crate::constants::DEFAULT_EVENT_RETENTION;
use crate::extractors::{PartialMeta, RequestMeta};
use crate::utils::SeqCount;

pub const CONTENT_TYPE: &str = "application/x-sentry-envelope";

Expand Down Expand Up @@ -872,27 +871,6 @@ impl Item {
self.headers.other.insert(name.into(), value.into())
}

/// Counts how many spans are contained in a transaction payload.
///
/// The transaction itself represents a span as well, so this function returns
/// `len(event.spans) + 1`.
///
/// Returns zero if
/// - the item is not a transaction,
/// - the spans have already been extracted (in which case they are represented elsewhere).
pub fn count_nested_spans(&self) -> usize {
#[derive(Debug, Deserialize)]
struct PartialEvent {
spans: SeqCount,
}

if self.ty() != &ItemType::Transaction || self.spans_extracted() {
return 0;
}

serde_json::from_slice::<PartialEvent>(&self.payload()).map_or(0, |event| event.spans.0 + 1)
}

/// Determines whether the given item creates an event.
///
/// This is only true for literal events and crash report attachments.
Expand Down
17 changes: 15 additions & 2 deletions relay-server/src/metrics_extraction/event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ impl Extractable for Span {
/// If this is a transaction event with spans, metrics will also be extracted from the spans.
pub fn extract_metrics(
event: &mut Event,
spans_extracted: bool,
config: CombinedMetricExtractionConfig<'_>,
max_tag_value_size: usize,
span_extraction_sample_rate: Option<f32>,
) -> Vec<Bucket> {
let mut metrics = generic::extract_metrics(event, config);
if sample(span_extraction_sample_rate.unwrap_or(1.0)) {
// If spans were already extracted for an event, we rely on span processing to extract metrics.
if !spans_extracted && sample(span_extraction_sample_rate.unwrap_or(1.0)) {
extract_span_metrics_for_event(event, config, max_tag_value_size, &mut metrics);
}

Expand Down Expand Up @@ -1200,6 +1202,7 @@ mod tests {

extract_metrics(
event.value_mut().as_mut().unwrap(),
false,
combined_config(features, None).combined(),
200,
None,
Expand Down Expand Up @@ -1410,6 +1413,7 @@ mod tests {

let metrics = extract_metrics(
event.value_mut().as_mut().unwrap(),
false,
combined_config([Feature::ExtractCommonSpanMetricsFromEvent], None).combined(),
200,
None,
Expand Down Expand Up @@ -1466,6 +1470,7 @@ mod tests {

let metrics = extract_metrics(
event.value_mut().as_mut().unwrap(),
false,
combined_config([Feature::ExtractCommonSpanMetricsFromEvent], None).combined(),
200,
None,
Expand Down Expand Up @@ -1497,6 +1502,7 @@ mod tests {

let metrics = extract_metrics(
event.value_mut().as_mut().unwrap(),
false,
combined_config([Feature::ExtractCommonSpanMetricsFromEvent], None).combined(),
200,
None,
Expand Down Expand Up @@ -1759,6 +1765,7 @@ mod tests {

let metrics = extract_metrics(
event.value_mut().as_mut().unwrap(),
false,
combined_config([Feature::ExtractCommonSpanMetricsFromEvent], None).combined(),
200,
None,
Expand Down Expand Up @@ -1899,7 +1906,13 @@ mod tests {
);
let config = binding.combined();

let _ = extract_metrics(event.value_mut().as_mut().unwrap(), config, 200, None);
let _ = extract_metrics(
event.value_mut().as_mut().unwrap(),
false,
config,
200,
None,
);

insta::assert_debug_snapshot!(&event.value().unwrap()._metrics_summary);
insta::assert_debug_snapshot!(
Expand Down
Loading

0 comments on commit 45a33a2

Please sign in to comment.