Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
c413975a
Commit
c413975a
authored
8 years ago
by
Apoorv Naik
Committed by
Vimal Sharma
8 years ago
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce excessive exception logging
parent
74a8de1a
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
119 additions
and
49 deletions
+119
-49
AtlasAuthorizationUtils.java
...pache/atlas/authorize/simple/AtlasAuthorizationUtils.java
+15
-7
release-log.txt
release-log.txt
+1
-0
GraphTransactionInterceptor.java
...in/java/org/apache/atlas/GraphTransactionInterceptor.java
+6
-6
EntityNotFoundException.java
...e/atlas/typesystem/exception/EntityNotFoundException.java
+1
-3
NotFoundException.java
.../apache/atlas/typesystem/exception/NotFoundException.java
+46
-0
SchemaNotFoundException.java
...e/atlas/typesystem/exception/SchemaNotFoundException.java
+1
-3
TraitNotFoundException.java
...he/atlas/typesystem/exception/TraitNotFoundException.java
+1
-2
AtlasBaseExceptionMapper.java
...org/apache/atlas/web/errors/AtlasBaseExceptionMapper.java
+9
-27
ExceptionMapperUtil.java
...java/org/apache/atlas/web/errors/ExceptionMapperUtil.java
+0
-1
NotFoundExceptionMapper.java
.../org/apache/atlas/web/errors/NotFoundExceptionMapper.java
+39
-0
No files found.
authorization/src/main/java/org/apache/atlas/authorize/simple/AtlasAuthorizationUtils.java
View file @
c413975a
...
@@ -18,15 +18,16 @@
...
@@ -18,15 +18,16 @@
package
org
.
apache
.
atlas
.
authorize
.
simple
;
package
org
.
apache
.
atlas
.
authorize
.
simple
;
import
java.util.HashSet
;
import
java.util.Set
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.AtlasClient
;
import
org.apache.atlas.authorize.AtlasActionTypes
;
import
org.apache.atlas.authorize.AtlasActionTypes
;
import
org.apache.atlas.authorize.AtlasResourceTypes
;
import
org.apache.atlas.authorize.AtlasResourceTypes
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
java.util.HashSet
;
import
java.util.Objects
;
import
java.util.Set
;
public
class
AtlasAuthorizationUtils
{
public
class
AtlasAuthorizationUtils
{
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAuthorizationUtils
.
class
);
private
static
final
Logger
LOG
=
LoggerFactory
.
getLogger
(
AtlasAuthorizationUtils
.
class
);
private
static
boolean
isDebugEnabled
=
LOG
.
isDebugEnabled
();
private
static
boolean
isDebugEnabled
=
LOG
.
isDebugEnabled
();
...
@@ -47,7 +48,13 @@ public class AtlasAuthorizationUtils {
...
@@ -47,7 +48,13 @@ public class AtlasAuthorizationUtils {
String
[]
split
=
contextPath
.
split
(
"/"
,
3
);
String
[]
split
=
contextPath
.
split
(
"/"
,
3
);
String
api
=
split
[
0
];
String
api
=
split
[
0
];
if
(
split
.
length
>
1
)
{
if
(
split
.
length
>
1
)
{
return
(!
api
.
equals
(
"v1"
))
?
api
:
String
.
format
(
"v1/%s"
,
split
[
1
]);
if
(
Objects
.
equals
(
api
,
"v1"
))
{
return
String
.
format
(
"v1/%s"
,
split
[
1
]);
}
else
if
(
Objects
.
equals
(
api
,
"v2"
))
{
return
String
.
format
(
"v2/%s"
,
split
[
1
]);
}
else
{
return
api
;
}
}
else
{
}
else
{
return
api
;
return
api
;
}
}
...
@@ -101,14 +108,15 @@ public class AtlasAuthorizationUtils {
...
@@ -101,14 +108,15 @@ public class AtlasAuthorizationUtils {
LOG
.
debug
(
"==> getAtlasResourceType for "
+
contextPath
);
LOG
.
debug
(
"==> getAtlasResourceType for "
+
contextPath
);
}
}
String
api
=
getApi
(
contextPath
);
String
api
=
getApi
(
contextPath
);
if
(
api
.
startsWith
(
"types"
))
{
if
(
api
.
startsWith
(
"types"
)
||
api
.
startsWith
(
"v2/types"
)
)
{
resourceTypes
.
add
(
AtlasResourceTypes
.
TYPE
);
resourceTypes
.
add
(
AtlasResourceTypes
.
TYPE
);
}
else
if
(
api
.
startsWith
(
"admin"
)
&&
(
contextPath
.
contains
(
"/session"
)
||
contextPath
.
contains
(
"/version"
)))
{
}
else
if
(
api
.
startsWith
(
"admin"
)
&&
(
contextPath
.
contains
(
"/session"
)
||
contextPath
.
contains
(
"/version"
)))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
UNKNOWN
);
resourceTypes
.
add
(
AtlasResourceTypes
.
UNKNOWN
);
}
else
if
((
api
.
startsWith
(
"discovery"
)
&&
contextPath
.
contains
(
"/gremlin"
))
||
api
.
startsWith
(
"admin"
)
}
else
if
((
api
.
startsWith
(
"discovery"
)
&&
contextPath
.
contains
(
"/gremlin"
))
||
api
.
startsWith
(
"admin"
)
||
api
.
startsWith
(
"graph"
))
{
||
api
.
startsWith
(
"graph"
))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
OPERATION
);
resourceTypes
.
add
(
AtlasResourceTypes
.
OPERATION
);
}
else
if
(
api
.
startsWith
(
"entities"
)
||
api
.
startsWith
(
"lineage"
)
||
api
.
startsWith
(
"discovery"
))
{
}
else
if
(
api
.
startsWith
(
"entities"
)
||
api
.
startsWith
(
"lineage"
)
||
api
.
startsWith
(
"discovery"
)
||
api
.
startsWith
(
"v2/entity"
))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
ENTITY
);
resourceTypes
.
add
(
AtlasResourceTypes
.
ENTITY
);
}
else
if
(
api
.
startsWith
(
"v1/taxonomies"
))
{
}
else
if
(
api
.
startsWith
(
"v1/taxonomies"
))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
TAXONOMY
);
resourceTypes
.
add
(
AtlasResourceTypes
.
TAXONOMY
);
...
@@ -117,7 +125,7 @@ public class AtlasAuthorizationUtils {
...
@@ -117,7 +125,7 @@ public class AtlasAuthorizationUtils {
if
(
contextPath
.
contains
(
"/terms"
))
{
if
(
contextPath
.
contains
(
"/terms"
))
{
resourceTypes
.
add
(
AtlasResourceTypes
.
TERM
);
resourceTypes
.
add
(
AtlasResourceTypes
.
TERM
);
}
}
}
else
if
(
api
.
startsWith
(
"v1/entities"
))
{
}
else
if
(
api
.
startsWith
(
"v1/entities"
)
||
api
.
startsWith
(
"v2/entities"
)
)
{
resourceTypes
.
add
(
AtlasResourceTypes
.
ENTITY
);
resourceTypes
.
add
(
AtlasResourceTypes
.
ENTITY
);
}
else
{
}
else
{
LOG
.
error
(
"Unable to find Atlas Resource corresponding to : "
+
api
+
"\nSetting "
LOG
.
error
(
"Unable to find Atlas Resource corresponding to : "
+
api
+
"\nSetting "
...
...
This diff is collapsed.
Click to expand it.
release-log.txt
View file @
c413975a
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
...
@@ -9,6 +9,7 @@ ATLAS-1060 Add composite indexes for exact match performance improvements for al
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ATLAS-1127 Modify creation and modification timestamps to Date instead of Long(sumasai)
ALL CHANGES:
ALL CHANGES:
ATLAS-1349 Reduce excessive exception logging (apoorvnaik via svimal2106)
ATLAS-1343 CTAS query is not captured by Atlas with Hive2 (svimal2106)
ATLAS-1343 CTAS query is not captured by Atlas with Hive2 (svimal2106)
ATLAS-1337 fixed FalconHookIT (ayubpathan via mneethiraj)
ATLAS-1337 fixed FalconHookIT (ayubpathan via mneethiraj)
ATLAS-1338 fix SqoopHookIT (ayubpathan via mneethiraj)
ATLAS-1338 fix SqoopHookIT (ayubpathan via mneethiraj)
...
...
This diff is collapsed.
Click to expand it.
repository/src/main/java/org/apache/atlas/GraphTransactionInterceptor.java
View file @
c413975a
...
@@ -19,13 +19,14 @@ package org.apache.atlas;
...
@@ -19,13 +19,14 @@ package org.apache.atlas;
import
org.aopalliance.intercept.MethodInterceptor
;
import
org.aopalliance.intercept.MethodInterceptor
;
import
org.aopalliance.intercept.MethodInvocation
;
import
org.aopalliance.intercept.MethodInvocation
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graph.AtlasGraphProvider
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.repository.graphdb.AtlasGraph
;
import
org.apache.atlas.typesystem.exception.EntityNotFoundException
;
import
org.apache.atlas.typesystem.exception.NotFoundException
;
import
org.apache.atlas.typesystem.exception.SchemaNotFoundException
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
import
javax.ws.rs.core.Response
;
import
java.util.ArrayList
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.util.List
;
...
@@ -79,10 +80,9 @@ public class GraphTransactionInterceptor implements MethodInterceptor {
...
@@ -79,10 +80,9 @@ public class GraphTransactionInterceptor implements MethodInterceptor {
}
}
boolean
logException
(
Throwable
t
)
{
boolean
logException
(
Throwable
t
)
{
if
((
t
instanceof
SchemaNotFoundException
)
||
(
t
instanceof
EntityNotFoundException
))
{
return
!(
t
instanceof
NotFoundException
)
&&
return
false
;
((
t
instanceof
AtlasBaseException
)
&&
}
((
AtlasBaseException
)
t
).
getAtlasErrorCode
().
getHttpCode
()
!=
Response
.
Status
.
NOT_FOUND
);
return
true
;
}
}
public
static
abstract
class
PostTransactionHook
{
public
static
abstract
class
PostTransactionHook
{
...
...
This diff is collapsed.
Click to expand it.
server-api/src/main/java/org/apache/atlas/typesystem/exception/EntityNotFoundException.java
View file @
c413975a
...
@@ -18,12 +18,10 @@
...
@@ -18,12 +18,10 @@
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
import
org.apache.atlas.AtlasException
;
/**
/**
* A simple wrapper for 404.
* A simple wrapper for 404.
*/
*/
public
class
EntityNotFoundException
extends
Atlas
Exception
{
public
class
EntityNotFoundException
extends
NotFound
Exception
{
public
EntityNotFoundException
()
{
public
EntityNotFoundException
()
{
}
}
...
...
This diff is collapsed.
Click to expand it.
server-api/src/main/java/org/apache/atlas/typesystem/exception/NotFoundException.java
0 → 100644
View file @
c413975a
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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.
*/
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
import
org.apache.atlas.AtlasException
;
/**
* A simple wrapper for 404.
*/
public
class
NotFoundException
extends
AtlasException
{
public
NotFoundException
()
{
}
public
NotFoundException
(
String
message
)
{
super
(
message
);
}
public
NotFoundException
(
String
message
,
Throwable
cause
)
{
super
(
message
,
cause
);
}
public
NotFoundException
(
Throwable
cause
)
{
super
(
cause
);
}
public
NotFoundException
(
String
message
,
Throwable
cause
,
boolean
enableSuppression
,
boolean
writableStackTrace
)
{
super
(
message
,
cause
,
enableSuppression
,
writableStackTrace
);
}
}
This diff is collapsed.
Click to expand it.
server-api/src/main/java/org/apache/atlas/typesystem/exception/SchemaNotFoundException.java
View file @
c413975a
...
@@ -17,9 +17,7 @@
...
@@ -17,9 +17,7 @@
*/
*/
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
import
org.apache.atlas.AtlasException
;
public
class
SchemaNotFoundException
extends
NotFoundException
{
public
class
SchemaNotFoundException
extends
AtlasException
{
public
SchemaNotFoundException
()
{
public
SchemaNotFoundException
()
{
}
}
...
...
This diff is collapsed.
Click to expand it.
server-api/src/main/java/org/apache/atlas/typesystem/exception/TraitNotFoundException.java
View file @
c413975a
...
@@ -17,13 +17,12 @@
...
@@ -17,13 +17,12 @@
*/
*/
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
package
org
.
apache
.
atlas
.
typesystem
.
exception
;
import
org.apache.atlas.AtlasException
;
/**
/**
* A simple wrapper for 404.
* A simple wrapper for 404.
* Thrown when a requested trait can not be found.
* Thrown when a requested trait can not be found.
*/
*/
public
class
TraitNotFoundException
extends
AtlasException
{
public
class
TraitNotFoundException
extends
NotFoundException
{
public
TraitNotFoundException
()
{
public
TraitNotFoundException
()
{
}
}
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/errors/AtlasBaseExceptionMapper.java
View file @
c413975a
...
@@ -21,34 +21,31 @@ package org.apache.atlas.web.errors;
...
@@ -21,34 +21,31 @@ package org.apache.atlas.web.errors;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.AtlasErrorCode
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.apache.atlas.type.AtlasType
;
import
org.apache.atlas.type.AtlasType
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.concurrent.ThreadLocalRandom
;
import
javax.inject.Singleton
;
import
javax.inject.Singleton
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.ext.ExceptionMapper
;
import
javax.ws.rs.ext.ExceptionMapper
;
import
javax.ws.rs.ext.Provider
;
import
javax.ws.rs.ext.Provider
;
import
java.util.LinkedHashMap
;
import
java.util.Map
;
import
java.util.concurrent.ThreadLocalRandom
;
/**
/**
* Exception mapper for Jersey.
* AtlasBaseException mapper for Jersey.
* @param <E>
*/
*/
@Provider
@Provider
@Singleton
@Singleton
public
class
AtlasBaseExceptionMapper
implements
ExceptionMapper
<
AtlasBaseException
>
{
public
class
AtlasBaseExceptionMapper
implements
ExceptionMapper
<
AtlasBaseException
>
{
private
static
final
Logger
LOGGER
=
LoggerFactory
.
getLogger
(
AtlasBaseExceptionMapper
.
class
);
@Override
@Override
public
Response
toResponse
(
AtlasBaseException
exception
)
{
public
Response
toResponse
(
AtlasBaseException
exception
)
{
final
long
id
=
ThreadLocalRandom
.
current
().
nextLong
();
final
long
id
=
ThreadLocalRandom
.
current
().
nextLong
();
// Log the response and use the error codes from the Exception
// Only log the exception is there's an internal error
logException
(
id
,
exception
);
if
(
exception
.
getAtlasErrorCode
().
getHttpCode
()
==
Response
.
Status
.
INTERNAL_SERVER_ERROR
)
{
return
buildAtlasBaseExceptionResponse
((
AtlasBaseException
)
exception
);
ExceptionMapperUtil
.
logException
(
id
,
exception
);
}
return
buildAtlasBaseExceptionResponse
(
exception
);
}
}
protected
Response
buildAtlasBaseExceptionResponse
(
AtlasBaseException
baseException
)
{
protected
Response
buildAtlasBaseExceptionResponse
(
AtlasBaseException
baseException
)
{
...
@@ -64,19 +61,4 @@ public class AtlasBaseExceptionMapper implements ExceptionMapper<AtlasBaseExcept
...
@@ -64,19 +61,4 @@ public class AtlasBaseExceptionMapper implements ExceptionMapper<AtlasBaseExcept
}
}
return
responseBuilder
.
build
();
return
responseBuilder
.
build
();
}
}
@SuppressWarnings
(
"UnusedParameters"
)
protected
String
formatErrorMessage
(
long
id
,
AtlasBaseException
exception
)
{
return
String
.
format
(
"There was an error processing your request. It has been logged (ID %016x)."
,
id
);
}
protected
void
logException
(
long
id
,
AtlasBaseException
exception
)
{
LOGGER
.
error
(
formatLogMessage
(
id
,
exception
),
exception
);
}
@SuppressWarnings
(
"UnusedParameters"
)
protected
String
formatLogMessage
(
long
id
,
Throwable
exception
)
{
return
String
.
format
(
"Error handling a request: %016x"
,
id
);
}
}
}
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/errors/ExceptionMapperUtil.java
View file @
c413975a
...
@@ -17,7 +17,6 @@
...
@@ -17,7 +17,6 @@
*/
*/
package
org
.
apache
.
atlas
.
web
.
errors
;
package
org
.
apache
.
atlas
.
web
.
errors
;
import
org.apache.atlas.exception.AtlasBaseException
;
import
org.slf4j.Logger
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.slf4j.LoggerFactory
;
...
...
This diff is collapsed.
Click to expand it.
webapp/src/main/java/org/apache/atlas/web/errors/NotFoundExceptionMapper.java
0 → 100644
View file @
c413975a
/**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you 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
* <p>
* http://www.apache.org/licenses/LICENSE-2.0
* <p>
* 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.
*/
package
org
.
apache
.
atlas
.
web
.
errors
;
import
org.apache.atlas.typesystem.exception.NotFoundException
;
import
javax.inject.Singleton
;
import
javax.ws.rs.core.Response
;
import
javax.ws.rs.ext.ExceptionMapper
;
import
javax.ws.rs.ext.Provider
;
import
java.util.concurrent.ThreadLocalRandom
;
@Provider
@Singleton
public
class
NotFoundExceptionMapper
implements
ExceptionMapper
<
NotFoundException
>
{
@Override
public
Response
toResponse
(
NotFoundException
e
)
{
final
long
id
=
ThreadLocalRandom
.
current
().
nextLong
();
return
Response
.
status
(
Response
.
Status
.
NOT_FOUND
)
.
entity
(
ExceptionMapperUtil
.
formatErrorMessage
(
id
,
e
))
.
build
();
}
}
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment