예제 #1
0
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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.

"""Monitoring metrics for the binary_health services."""

from upvote.gae.shared.common import monitoring
from upvote.monitoring import metrics


virustotal_requests = monitoring.SuccessFailureCounter(
    metrics.BINARY_HEALTH.VIRUSTOTAL_REQUESTS)

virustotal_new_lookups = monitoring.Counter(
    metrics.BINARY_HEALTH.VIRUSTOTAL_NEW_LOOKUPS, fields=[(u'state', str)])
예제 #2
0
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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.
"""Monitoring metrics for the binary_health services."""

from upvote.gae.shared.common import monitoring
from upvote.monitoring import metrics

virustotal_requests = monitoring.SuccessFailureCounter(
    metrics.ANALYSIS.VIRUSTOTAL_REQUESTS)

virustotal_new_lookups = monitoring.Counter(
    metrics.ANALYSIS.VIRUSTOTAL_NEW_LOOKUPS, fields=[(u'state', str)])
예제 #3
0
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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.
"""Monitoring metrics for generated statistics."""

from upvote.gae.shared.common import monitoring
from upvote.monitoring import metrics

rows_to_persist = monitoring.Metric(metrics.BIGQUERY.ROWS_TO_PERSIST, long)
rows_to_stream = monitoring.Metric(metrics.BIGQUERY.ROWS_TO_STREAM, long)
rows_streamed = monitoring.Counter(metrics.BIGQUERY.ROWS_STREAMED)
예제 #4
0
# 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.
"""Model representations of BigQuery rows for streaming data."""

from google.appengine.ext import deferred
from google.appengine.ext import ndb
from google.appengine.ext.ndb import polymodel

from upvote.gae.datastore import utils as model_utils
from upvote.gae.shared.common import settings
from upvote.gae.shared.common import monitoring
from upvote.monitoring import metrics
from upvote.shared import constants

_PERSISTED_METRIC = monitoring.Counter(metrics.BIGQUERY.ROWS_PERSISTED)


class BigQueryRow(polymodel.PolyModel):
    """Base class for all rows being persisted for BigQuery streaming."""
    @classmethod
    def DeferCreate(cls, **row_params):
        if not settings.ENV.ENABLE_BIGQUERY_STREAMING:
            return
        deferred.defer(cls.Create,
                       _queue=constants.TASK_QUEUE.BQ_PERSISTENCE,
                       _transactional=ndb.in_transaction(),
                       **row_params)

    @classmethod
    def Create(cls, **row_params):
예제 #5
0
# Copyright 2017 Google Inc. All Rights Reserved.
#
# 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.
"""Monitoring metrics for the bit9_api AppEngine module."""

from upvote.gae.shared.common import monitoring
from upvote.monitoring import metrics

events_to_pull = monitoring.Metric(metrics.BIT9_API.EVENTS_TO_PULL, long)
events_pulled = monitoring.Counter(metrics.BIT9_API.EVENTS_PULLED)
events_to_process = monitoring.Metric(metrics.BIT9_API.EVENTS_TO_PROCESS, long)
events_processed = monitoring.Counter(metrics.BIT9_API.EVENTS_PROCESSED)
pending_changes = monitoring.Metric(metrics.BIT9_API.PENDING_CHANGES, long)
예제 #6
0
#     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.

"""Monitoring metrics for the bit9_api AppEngine module."""

from upvote.gae.shared.common import monitoring
from upvote.monitoring import metrics


events_to_pull = monitoring.Metric(metrics.BIT9_API.EVENTS_TO_PULL, long)
events_pulled = monitoring.Counter(metrics.BIT9_API.EVENTS_PULLED)
events_to_process = monitoring.Metric(
    metrics.BIT9_API.EVENTS_TO_PROCESS, long)
events_processed = monitoring.Counter(metrics.BIT9_API.EVENTS_PROCESSED)
events_skipped = monitoring.Counter(metrics.BIT9_API.EVENTS_SKIPPED)
pending_changes = monitoring.Metric(metrics.BIT9_API.PENDING_CHANGES, long)

# Bit9 integration metrics
bit9_logins = monitoring.SuccessFailureCounter(metrics.BIT9_API.BIT9_LOGINS)
bit9_qps = monitoring.Counter(metrics.BIT9_API.BIT9_QPS)
bit9_requests = monitoring.Counter(
    metrics.BIT9_API.BIT9_REQUESTS,
    fields=[('http_method', str), ('api_object', str), ('http_status', int)])
bit9_latency = monitoring.LatencyMetric(
    metrics.BIT9_API.BIT9_LATENCY,
    fields=[('http_method', str), ('api_object', str)])