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

com.intergral.deep.plugin.cf.CFPlugin Maven / Gradle / Ivy

/*
 *     Copyright (C) 2023  Intergral GmbH
 *
 *     This program is free software: you can redistribute it and/or modify
 *     it under the terms of the GNU Affero General Public License as published by
 *     the Free Software Foundation, either version 3 of the License, or
 *     (at your option) any later version.
 *
 *     This program is distributed in the hope that it will be useful,
 *     but WITHOUT ANY WARRANTY; without even the implied warranty of
 *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *     GNU Affero General Public License for more details.
 *
 *     You should have received a copy of the GNU Affero General Public License
 *     along with this program.  If not, see .
 */

package com.intergral.deep.plugin.cf;

import com.intergral.deep.agent.api.plugin.ISnapshotContext;
import com.intergral.deep.agent.api.plugin.ISnapshotDecorator;
import com.intergral.deep.agent.api.resource.Resource;
import com.intergral.deep.agent.api.settings.ISettings;
import com.intergral.deep.agent.api.spi.IConditional;
import com.intergral.deep.agent.api.spi.IDeepPlugin;
import java.util.HashMap;

/**
 * This plugin is activated when we are running on an adobe CF server.
 * 

* This plugin will attach the cf version and the cf app name to the captured snapshots. */ public class CFPlugin implements IDeepPlugin, IConditional, ISnapshotDecorator { @Override public Resource decorate(final ISettings settings, final ISnapshotContext context) { String appName = null; try { appName = context.evaluateExpression("APPLICATION.applicationname"); } catch (Throwable ignored) { // nothing we can do - so ignore } final HashMap cfAttributes = new HashMap<>(); cfAttributes.put("cf_version", Utils.loadCFVersion()); if (appName != null) { cfAttributes.put("app_name", appName); } return Resource.create(cfAttributes); } @Override public boolean isActive() { return Utils.isCFServer(); } }





© 2015 - 2024 Weber Informatics LLC | Privacy Policy