Skip to content

Report active spring profile #4041

@adinauer

Description

@adinauer

Problem Statement

Our Spring Boot integration could report active spring profiles by default.

This may help customers find issues with profiles not being applied or having the wrong profile active for any environment.

Solution Brainstorm

Adding this to our sample app:

  @Bean
  public SentryOptions.BeforeSendCallback beforeSendCallback(Environment environment) {
    return (event, hint) -> {
      event.setTag("active-spring-profiles", Arrays.toString(environment.getActiveProfiles()));
      return event;
    };
  }

produces the following in an event with SPRING_PROFILES_ACTIVE=eu-staging:

    "tags":
    {
        "my-partition-tag": "europe-tag",
        "active-spring-profiles": "[eu-staging]"
    },

and the following without any active profile:

    "tags":
    {
        "active-spring-profiles": "[]"
    },

We could replace the empty array with "default" instead.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

Status

Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions